How to deploy official eclipse-mosquitto container on a raspberry pi as a service in a docker compose file?

I would like to install the official eclipse-mosquitto container on my raspberry pi as a service in a docker compose file.

To do so I have added following lines to my docker-compose.yml

...
  mqtt2:
    image: eclipse-mosquitto
    ports:
      - "1884:1883"
...

but when balena deploys it I am getting following error in the log file:

01.04.19 10:16:39 (+0200)  mqtt2  standard_init_linux.go:195: exec user process caused "exec format error"
01.04.19 10:16:47 (+0200)  mqtt2  standard_init_linux.go:195: exec user process caused "exec format error"
01.04.19 10:16:52 (+0200)  mqtt2  standard_init_linux.go:195: exec user process caused "exec format error"

This most likely means that balena has installed an image for a different hardware architecture (so not compatible for my raspberry pi 3B).

Note that according to the eclipse-mosquitto documentation it is supported on ARM and ARM64 architecture

So how I can fix this problem ?

jan.

I have found the fix.

On the docker hub link: eclipse-mosquitto
you can find a section Supported architectures with following content:

Supported architectures : (more info)
amd64 , arm32v6 , arm64v8 , i386 , ppc64le , s390x

For Raspberry Pi 3B you need to select arm32v7 or arm32v6 in case v7 is not available and this will navigate you to arm32v6/eclipse-mosquitto
which will tell you to use arm32v6/eclipse-mosquitto as image.

So the following commands in the docker-compose.yml should work for a raspberry Pi 3B.

  mqtt:
    image: arm32v6/eclipse-mosquitto
    ports:
      - "1883:1883"

@janvda Glad you found the solution. Unfortunately our builder doesn’t (yet) understand the docker manifests, so when you use the official images, it pulls the default x86 architecture base image rather than the ARM one that the rpi needs. We hope to support this eventually, but for now you need to explicitly define the target arch as you have in your solution.

1 Like