openfaas / of-watchdog

Reverse proxy for STDIO and HTTP microservices
MIT License
259 stars 115 forks source link

problem with the 0.9.13 arm64 image #157

Closed xo-dimontie-xo closed 5 months ago

xo-dimontie-xo commented 6 months ago

Expected Behaviour

I should be able to automatically pull the correct image for my arch docker run --rm ghcr.io/openfaas/of-watchdog:0.9.13 --version

Current Behaviour

I can't seem to automatically pull down the linux/arm64 image for version 0.9.13

dim@pi5:~/git-repo/of-watchdog $ docker run --rm ghcr.io/openfaas/of-watchdog:0.9.13 --version
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
exec /fwatchdog: exec format error

it works for previous versions 0.9.11 and 0.9.12 for example

dim@pi5:~/git-repo/of-watchdog $ docker run --rm ghcr.io/openfaas/of-watchdog:0.9.11 --version
2023/12/31 15:22:03 Version: 0.9.11 SHA: ae2f5089ae66f81a1475c4664cb8f5edb6c096bf
dim@pi5:~/git-repo/of-watchdog $ docker run --rm ghcr.io/openfaas/of-watchdog:0.9.12 --version
2023/12/31 15:22:08 Version: 0.9.12 SHA: 5d4cadcaf595f3d3d213e08cdd38a310c5bb3066

Possible Solution

if I use the sha version of 0.9.13 for arm64 it does work, at the moment I can't build any functions as the templates default to 0.9.13. I will go and edit my copy of the store templates.

Your Environment

dim@pi5:~/git-repo/of-watchdog $ uname -a
Linux pi5 6.1.0-rpi7-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux

Docker Version

Client:
 Version:           20.10.24+dfsg1
 API version:       1.41
 Go version:        go1.19.8
 Git commit:        297e128
 Built:             Thu May 18 08:41:26 2023
 OS/Arch:           linux/arm64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.24+dfsg1
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.19.8
  Git commit:       5d6db84
  Built:            Thu May 18 08:41:26 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.20~ds1
  GitCommit:        1.6.20~ds1-1+b1
 runc:
  Version:          1.1.5+ds1
  GitCommit:        1.1.5+ds1-1+b1
 docker-init:
  Version:          0.19.0
  GitCommit:

faasd, raspberry pi 5

rgee0 commented 6 months ago

If the platform is to be supported then the platforms flag here likely needs the v8 pattern adding:

https://github.com/openfaas/of-watchdog/blob/485e3604a7ac1ca25517a281c0edeb701e93a723/Makefile#L63

xo-dimontie-xo commented 6 months ago

I could make a PR but I'm able to use the linux/arm64 one from the previous releases?

rgee0 commented 6 months ago

The error message shows that the target platform is being identified. A quick test would be to pull 13 with --platform=linux/arm64:

docker pull --platform=linux/arm64 ghcr.io/openfaas/of-watchdog:0.9.13

It then exists locally as what the templates expect. Do you see different behaviour if you try to progress from here? This isn't a resolution, but might help with understanding of the issue, which I suspect might be outside of this project.

Comparing the current and previous releases we see:

$ docker buildx imagetools inspect ghcr.io/openfaas/of-watchdog:0.9.13
Name:      ghcr.io/openfaas/of-watchdog:0.9.13
MediaType: application/vnd.docker.distribution.manifest.list.v2+json
Digest:    sha256:312515fbc8cfa5a61aecceb9bd916ad5db119c4d8c8e03e3b86b5f8573991ba3

Manifests: 
  Name:      ghcr.io/openfaas/of-watchdog:0.9.13@sha256:c28a8915578a34e68564729fa2c0cf8d95c7a981a4e799c7a4b8633b3965d102
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/amd64

  Name:      ghcr.io/openfaas/of-watchdog:0.9.13@sha256:571e9013a4e7f4d19feaafafc0e1cf4874d9656dab9c3b32e8d5cdd332fdab40
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/arm64

  Name:      ghcr.io/openfaas/of-watchdog:0.9.13@sha256:ee096a2b395bbd8f75d855d1662413bdc6acbb3b72e39465adf8a207348897a7
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/arm/v7

and

$ docker buildx imagetools inspect ghcr.io/openfaas/of-watchdog:0.9.12
Name:      ghcr.io/openfaas/of-watchdog:0.9.12
MediaType: application/vnd.docker.distribution.manifest.list.v2+json
Digest:    sha256:e75479a51698e348475e0d1d5f668f2e122b76477558d1e012bd028f5d3979ef

Manifests: 
  Name:      ghcr.io/openfaas/of-watchdog:0.9.12@sha256:3a05addb6069e4b3b489d704d303ad809f2664dc9483479abc2f1f42581ce469
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/amd64

  Name:      ghcr.io/openfaas/of-watchdog:0.9.12@sha256:f5c9c9544bdde82d735b29472fe02bcb4637072ecfa014ad3f6495aea1305dbc
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/arm64

  Name:      ghcr.io/openfaas/of-watchdog:0.9.12@sha256:f63010870709718c460e52c9a4b9072999f4b5c7dfe30993a54d028dc662a3a7
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/arm/v7

So if 12 is working then you'd expect 13 to be.... except if the images for 11 & 12 were already on your Pi, in which case Docker would likely use the local image.

On an amd64 Mac I pulled the ARM image:

$ docker pull --platform=linux/arm64 ghcr.io/openfaas/of-watchdog:0.9.13
0.9.13: Pulling from openfaas/of-watchdog
4a912a76ddd7: Pull complete 
Digest: sha256:312515fbc8cfa5a61aecceb9bd916ad5db119c4d8c8e03e3b86b5f8573991ba3
Status: Downloaded newer image for ghcr.io/openfaas/of-watchdog:0.9.13
ghcr.io/openfaas/of-watchdog:0.9.13

Then ran the command you've shared I see the same error but in reverse:

$ docker run --rm ghcr.io/openfaas/of-watchdog:0.9.13 --version
WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and no specific platform was requested
2024/01/01 21:02:28 Version: 0.9.13 SHA: 485e3604a7ac1ca25517a281c0edeb701e93a723

Pulling the correct image:

$ docker pull --platform=linux/amd64 ghcr.io/openfaas/of-watchdog:0.9.13
0.9.13: Pulling from openfaas/of-watchdog
Digest: sha256:312515fbc8cfa5a61aecceb9bd916ad5db119c4d8c8e03e3b86b5f8573991ba3
Status: Downloaded newer image for ghcr.io/openfaas/of-watchdog:0.9.13
ghcr.io/openfaas/of-watchdog:0.9.13

$ docker run --rm ghcr.io/openfaas/of-watchdog:0.9.13 --version         
2024/01/01 21:03:51 Version: 0.9.13 SHA: 485e3604a7ac1ca25517a281c0edeb701e93a723

.... Inspecting the ARM image shows that the image itself accurately reflects the target platform:

$ docker inspect ghcr.io/openfaas/of-watchdog:0.9.13
[
    {
        "Id": "sha256:955fcc2edf797367a931a2532d3b74b536f52e77369332d87b845adf08a9cf68",
        "RepoTags": [
            "ghcr.io/openfaas/of-watchdog:0.9.13"
        ],
        "RepoDigests": [],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2023-11-10T10:43:47.090269758Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "/",
            "Entrypoint": [
                "/fwatchdog"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "arm64",
        "Os": "linux",
        "Size": 8781824,
        "VirtualSize": 8781824,
        "GraphDriver": {
            "Data": {
                "MergedDir": "/var/lib/docker/overlay2/96807d011dea8b5438fb21ca68f502ad83c0cf1de72ed05096d9665c623e30d4/merged",
                "UpperDir": "/var/lib/docker/overlay2/96807d011dea8b5438fb21ca68f502ad83c0cf1de72ed05096d9665c623e30d4/diff",
                "WorkDir": "/var/lib/docker/overlay2/96807d011dea8b5438fb21ca68f502ad83c0cf1de72ed05096d9665c623e30d4/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:2fd4eeb85a7ac788d96e60fbe969af24a3a842ffe38d839db1c5186ab2ba9879"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
alexellis commented 5 months ago

Hi, I was able to run this without issue:

alex@raspberrypi:~ $ docker run --rm ghcr.io/openfaas/of-watchdog:0.9.13 --version
Unable to find image 'ghcr.io/openfaas/of-watchdog:0.9.13' locally
0.9.13: Pulling from openfaas/of-watchdog
4a912a76ddd7: Pull complete 
Digest: sha256:312515fbc8cfa5a61aecceb9bd916ad5db119c4d8c8e03e3b86b5f8573991ba3
Status: Downloaded newer image for ghcr.io/openfaas/of-watchdog:0.9.13
2024/01/31 16:45:29 Version: 0.9.13 SHA: 485e3604a7ac1ca25517a281c0edeb701e93a723
alex@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.0-rpi7-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
alex@raspberrypi:~ $ 

0.9.15 also works:

alex@raspberrypi:~ $ docker run --rm ghcr.io/openfaas/of-watchdog:0.9.15 --version
Unable to find image 'ghcr.io/openfaas/of-watchdog:0.9.15' locally
0.9.15: Pulling from openfaas/of-watchdog
b07a2c64ee13: Pull complete 
Digest: sha256:35a86a2449bdb463aae7b2d5254c6a55d47397d4d2a5e9209be8a3510149f932
Status: Downloaded newer image for ghcr.io/openfaas/of-watchdog:0.9.15
2024/01/31 16:46:11 Version: 0.9.15 SHA: bb7b23f61a2251aa158dac6d409f2fdff383f4f9