19

I've installed docker in rapsbian according to the official instructions (i.e., running curl -sSL https://get.docker.com | sh) but I'm not able to run the hello-world example (I've also tried other examples without success). This is the error I'm getting:

pi@raspberrypi2:~ $ docker run hello-world
standard_init_linux.go:178: exec user process caused "exec format error"

My environment is Raspberry Pi 2 Model B with Raspbian GNU/Linux 8 (jessie) and Docker version 17.03.0-ce, build 60ccb22.

Any hint about the problem or possible directions to solve the problem?

Many thanks!

Pablo EM
  • 6,190
  • 3
  • 29
  • 37

2 Answers2

34

Raspberries use ARM and not x86_64 processors. You can only run images created for that architecture. Try searching for ARM or ARMv7 on docker hub. There is a Debian image for ARM I know of but there must be others as well.

The underlying issue is that the binary format used by ARM is not compatible with x86_64, which is the architecture used by most desktop and server systems.

Peter Gerber
  • 1,023
  • 10
  • 13
  • 1
    You are right, thanks! In this link (https://hub.docker.com/u/armhf/) there are some useful official (in experimental stage currently) images for ARM architectures, including the `hello-world` example. – Pablo EM Mar 19 '17 at 14:11
  • As of November 2019 Docker has facilities for building for building for multiple architectures at the same time: https://mirailabs.io/blog/multiarch-docker-with-buildx/ – dshepherd Feb 24 '20 at 14:23
4

Add to the beginning of your file:

#!/bin/bash 

It works for me

Szymon Stepniak
  • 40,216
  • 10
  • 104
  • 131
Kairat Koibagarov
  • 1,385
  • 15
  • 9
  • 7
    @Kairat Koibagarov What do you mean add to beginning of your file... what file? – Kendall Jan 18 '18 at 23:57
  • You may have put a script file as CMD in your dockerfile. If so, you can add this at the beginning of this script file to tell your system how to read it (here it is a shell script) – bachinblack May 11 '18 at 12:34