Today I tried to install Docker on my Raspberry Pi 3 board to check how it will work, just for testing purpose. And you know what? It works very nice. First of all, I install Raspbinan Jessie Lite on SD card. For this point, I log in on a fresh installation and make the system update. After update list of repositories, I made the update of the whole raspberry:

The following packages will be upgraded:
  libpam-modules libpam-modules-bin libpam-runtime libpam0g libwbclient0 samba-common
6 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1111 kB of archives.
After this operation, 3072 B of additional disk space will be used.
Do you want to continue? [Y/n] Y

Next step is to install Docker directly from the Docker website for ARM architecture.

curl -sSL | sh

This process will take a few minutes. After installation finished we will see the latest installation of Docker and that is running on ARM architecture:

 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:19:15 2017
 OS/Arch:      linux/arm

 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:19:15 2017
 OS/Arch:      linux/arm
 Experimental: false

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

Installation process suggests us to use user pi and add them to docker group. This will allow us to run docker command without using the sudo command.

To check that Docker demons are running we can use: sudo docker info

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 17.03.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Kernel Version: 4.4.50-v7+
Operating System: Raspbian GNU/Linux 8 (jessie)
OSType: linux
Architecture: armv7l
CPUs: 4
Total Memory: 925.5 MiB
Name: raspberrypi3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
WARNING: No cpuset support
Experimental: false
Insecure Registries:
Live Restore Enabled: false

As you can see docker demons are running. After running classic: sudo docker run hello-world docker can’t find hello version:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest
standard_init_linux.go:178: exec user process caused "exec format error"

The container didn’t start. This problem appears due to incompatible between two architectures: ARM and x86. To solve this problem the best way is to find Docker image that can be run on ARM architecture. So how can we find this image? The best way is to find an image on Docker Hub. Searching for: ARM or RPI.


Another way is use Docker build to build our own Docker images for Raspberry. To create simple Dockerfile we must create the build directory, and in this folder placed Dockerfile that in my case contains:

FROM resin/rpi-raspbian:jessie
# install and update
RUN apt-get update && apt-get install -y oracle-java8-jdk && sudo apt-get clean
CMD ["java"]

To run Docker build: sudo docker build -t /rpi-java8. The build will take a while. After finish, we can check by using: sudo docker images. This will list:

REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
coffeina/rpi-java8   latest              e2590e5c574f        49 seconds ago      308 MB
resin/rpi-raspbian   jessie              5ba1e0e582ae        4 days ago          118 MB
hello-world          latest              48b5124b2768        2 months ago        1.84 kB

To run created Docker image we can use: sudo docker run -it /rpi-java8. But this displayed all options for java because I didn’t specify anything. After adding some variables like: java -version we can see:

java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee