Installing Docker Engine 19.03 on Raspberry Pi 3 in 2 Minutes

Estimated Reading Time: 6 minutes

Docker is officially supported both on Raspberry Pi 3 and 4. Installing Docker is just a matter of single-liner command. All you need to do is a simple curl command:

curl -sSL https://get.docker.com/ | sh

to get Docker binaries installed flawlessly. Isn’t it damn simple?

Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. An operating system is the set of basic programs and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi.

Docker today support the latest Raspbian Buster release. If you really want to play around with stable release of Docker for Raspbian Buster, then head over to this link.

Under this blog post, I will showcase how to install latest Docker Engine 19.03.1 on Raspbian OS Buster release flawlessly.

Tested Infrastructure

PlatformNumber of InstanceReading Time
Raspberry Pi 3 Model B15 min

Preparing Your Environment

ItemsLinkComments
Raspberry Pi 3 Model BBuy

Waveshare-LCD 5-inch TFT Resistive
Touch Screen Display Module
Buy

Geauxrobot Raspberry Pi 3 Model B 7-Layer
Dog Bone Stack Clear Case Box 
Buy

Prerequisite

  • Flash Raspbian OS on SD card

If you are in Mac, you might need to install Etcher tool. If on Windows, install SDFormatter to format SD card as well as Win32installer to flash Raspbian ISO image onto the SD card. You will need SD card reader to achieve this.

Booting up Raspbian OS

Just use the same charger which you use for your mobile to power on Raspberry Pi box. Connect HDMI port to your TV or display. Let it boot up.

The default username is pi and password is raspberry.

Enable SSH to perform remote login

To login via your laptop, you need to allow SSH service running. You can verify IP address command via ifconfig command.

[Captains-Bay]🚩 >  ssh pi@192.168.1.5
pi@192.168.1.5's password:
Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Feb 26 12:30:00 2019 from 192.168.1.4
pi@raspberrypi:~ $ sudo su
root@raspberrypi:/home/pi# cd

Verifying Raspbian OS Version

root@raspberrypi:~# cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
root@raspberrypi:~#

Installing Docker 19.03.1

Its a single liner command. -L means location, -s means silent and -S means show error.

root@raspberrypi:~# curl -sSL https://get.docker.com/ | sh

Deploying Nginx App

root@raspberrypi:~# docker run -d -p 80:80 nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
9c38b5a8a4d5: Pull complete
1c9b1b3e1e0d: Pull complete
258951b5612f: Pull complete
Digest: sha256:dd2d0ac3fff2f007d99e033b64854be0941e19a2ad51f174d9240dda20d9f534
Status: Downloaded newer image for nginx:latest
d812bf50d136b0f78353f0a0c763b6b08ecc5e7ce706bac8bd660cdd723e0fcd
root@raspberrypi:~#
root@raspberrypi:~# curl localhost:80
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
root@raspberrypi:~#
root@raspberrypi:~# docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 19.03.1
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 09c8266bf2fcf9519a651b04ae54c967b9ab86ec
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.14.98-v7+
Operating System: Raspbian GNU/Linux 9 (stretch)
OSType: linux
Architecture: armv7l
CPUs: 4
Total Memory: 927.2MiB
Name: raspberrypi
ID: FEUI:RVU6:AWPZ:6P22:TSLT:FDJC:CBIB:D2NU:AQEQ:IHVH:HFRY:HYWF
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

BuildKit on Raspberry Pi

root@raspberrypi:~# export DOCKER_BUILDKIT=1
root@raspberrypi:~# git clone https://github.com/ajeetraina/hellowhale
Cloning into 'hellowhale'...
remote: Enumerating objects: 28, done.
remote: Total 28 (delta 0), reused 0 (delta 0), pack-reused 28
Unpacking objects: 100% (28/28), done.
root@raspberrypi:~# cd hellowhale/
root@raspberrypi:~/hellowhale# ls
Dockerfile  html  README.md  wrapper.sh
root@raspberrypi:~/hellowhale# docker build -t ajeetraina/hellowhalecom .
[+] Building 7.9s (5/8)                                                         
 => [internal] load build definition from Dockerfile                       0.1s
 => => transferring dockerfile: 129B                                       0.0s
 => [internal] load .dockerignore                                          0.2s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/nginx:latest            0.0s
 => [1/3] FROM docker.io/library/nginx:latest                              0.0s
 => => resolve docker.io/library/nginx:latest                              0.0s
 => [internal] helper image for file operations                            0.1s
 => => resolve docker.io/docker/dockerfile-copy:v0.1.9@sha256:e8f159d3f00  7.5s
 => => sha256:b13ecc473b58ad8d80fba73ae6de690f6fcbe341bdaca42 736B / 736B  0.0s
 => => sha256:fabe16b757ee155dfd7210795199962d1b35e22b3437d06 767B / 767B  0.0s
 => [internal] load build context                                          0.1s
 => => transferring context: 34.39kB                                       0.0s

root@raspberrypi:~/hellowhale# time docker build -t ajeetraina/hellowhale .
[+] Building 0.4s (9/9) FINISHED                                                
 => [internal] load build definition from Dockerfile                       0.1s
 => => transferring dockerfile: 31B                                        0.0s
 => [internal] load .dockerignore                                          0.1s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/nginx:latest            0.0s
 => [internal] helper image for file operations                            0.0s
 => [1/3] FROM docker.io/library/nginx:latest                              0.0s
 => [internal] load build context                                          0.0s
 => => transferring context: 317B                                          0.0s
 => CACHED [2/3] COPY wrapper.sh /                                         0.0s
 => CACHED [3/3] COPY html /usr/share/nginx/html                           0.0s
 => exporting to image                                                     0.1s
 => => exporting layers                                                    0.0s
 => => writing image sha256:5aee990f7e24e7c0f486ed01b4c1f8696ff307f836af1  0.0s
 => => naming to docker.io/ajeetraina/hellowhale                           0.0s

real	0m0.615s
user	0m0.204s
sys	0m0.082s

Verifying Dockerd

root@raspberrypi:~/hellowhale# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e
   Active: active (running) since Tue 2019-02-26 13:01:04 IST; 38min ago
     Docs: https://docs.docker.com
 Main PID: 2437 (dockerd)
      CPU: 1min 46.174s
   CGroup: /system.slice/docker.service
           ├─2437 /usr/bin/dockerd -H unix://
           ├─2705 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8
           └─4186 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8

Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.400368104+0
Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.402012958+0
Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.402634316+0
Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.403005881+0
Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.408358205+0
Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.810154786+0
Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.810334839+0
Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.811462659+0
Feb 26 13:37:06 raspberrypi dockerd[2437]: time="2019-02-26T13:37:06.811768546+0
Feb 26 13:37:07 raspberrypi dockerd[2437]: time="2019-02-26T13:37:07.402282796+0

Verifying if armv7 hello-world image is available or not

docker run --rm mplatform/mquery hello-world
Unable to find image 'mplatform/mquery:latest' locally
latest: Pulling from mplatform/mquery
db6020507de3: Pull complete
5107afd39b7f: Pull complete
Digest: sha256:e15189e3d6fbcee8a6ad2ef04c1ec80420ab0fdcf0d70408c0e914af80dfb107
Status: Downloaded newer image for mplatform/mquery:latest
Image: hello-world
 * Manifest List: Yes
 * Supported platforms:
   - linux/amd64
   - linux/arm/v5
   - linux/arm/v7
   - linux/arm64
   - linux/386
   - linux/ppc64le
   - linux/s390x
   - windows/amd64:10.0.14393.2551
   - windows/amd64:10.0.16299.846
   - windows/amd64:10.0.17134.469
   - windows/amd64:10.0.17763.194

Verifying Hellowhale Image

root@raspberrypi:~# docker run --rm mplatform/mquery ajeetraina/hellowhale
Image: ajeetraina/hellowhale
 * Manifest List: No
 * Supports: amd64/linux

Verifying Random Images

root@raspberrypi:~# docker run --rm mplatform/mquery rycus86/prometheus
Image: rycus86/prometheus
 * Manifest List: Yes
 * Supported platforms:
   - linux/amd64
   - linux/arm/v7
   - linux/arm64

In my next blog post, I will showcase how to setup Docker Swarm on bunch of Raspberry Pi 3 nodes.

Test-Drive Docker 1.12 on first 64-bit ARM OpenSUSE running on Raspberry Pi 3

Estimated Reading Time: 5 minutesRaspberry Pi 3 Model B is the first 64 bit version and the third generation Pi box which runs on 1.2GHz 64 bit quad-core ARMv8 CPU.(Broadcom BCM2837 A53 ARM processor). Despite its processor upgrade, there wasn’t an official 64-bit OS available for it till the first week of Jan 2017. Kudos to SUSE Team, they came up providing first commercial enterprise Linux distribution optimized for ARM AARCH64 servers. This is definitely a BIG news. Reason –  To build a solution to meet specific market needs while maintaining a common code base. Enterprise vendors & customers demanding workload-optimized server platforms can now radically expand it for their modern data centers.

sles22

In the last couple of months, Docker enthusiasts have been working hard to get Docker running on ARM 32bit systems (like Raspberry Pi). With Docker Engine 1.12.1, a FIRST ARM Debian package was officially made available by Docker Inc. which happened late last year. This year, SUSE Team did a great job in bringing capabilities of SUSE Linux(a.k.a SLES for ARM) to the ARM AArch64 hardware platform. This is BIG news for Docker community too as more innovation and development is expected to grow building containers which will run across the  AARCH64 platform.

Under this blog, I am going to test drive Docker 1.12.3 on first 64-bit ARM Open SUSE distribution running on Raspberry Pi 3 box.

Hardware:

  1. Raspberry Pi 3 ( You can order it from Amazon in case you are in India for $35)
  2. Micro-SD card reader ( I got it from here )
  3. Any Windows or Linux Desktop or Laptop
  4. HDMI cable ( I used the HDMI cable of my plasma TV)
  5. Internet Connectivity(WiFi/Broadband/Tethering using Mobile) – to download Docker 1.12.3 package
  6. Keyboard & mouse connected to Pi’s USB ports

1

                                                                                            Source~http://www.rlocman.ru/i/Image/2016/02/29/RaspberryPi_3_1.jpg

Software:

  1. SD-Formatter – to format microSD card
  2. Rufus(in case you have Windows OS running on your laptop) – to burn OpenSUSE Leap 42.2 ARM XZ format directly into microSD card.(No need to extract XZ using any tool)

Steps:

  1. Format the microSD card using SD Formatter as shown below:

4

2. Download OpenSUSE Leap 42.2 ARM  OS from here and use Win32 imager(in case you are on Windows OS  running on your laptop) to burn it on microSD card.

rufus

3. Insert the microSD card into your Pi box. Now connect the HDMI cable  from one end of Pi’s HDMI slot to your TV or display unit and mobile charger(recommended 5.1V@1.5A) as shown:


23

4.You will see the fancy GUI coming up on your display:

sles2

5. To enable VNC, run the below command:

linux:~ # zypper install xorg-x11-Xvnc

linux:~# vncserver

Installing Docker 1.12.3 on first 64-bit ARM OpenSUSE

6. Run the below command:

$curl -sSLk https://get.docker.com/ | sh

sles4

7. Verify the docker version:

sles9

8. Let us try searching for Docker images present in Dockerhub based on aarch64:

sles10

Please be aware that the usual Docker containers are not going to work for this architecture. You need to pick up AARCH64 bit Docker images to run containers.

linux:~ # docker run busybox
Unable to find image ‘busybox:latest’ locally
latest: Pulling from library/busybox

557a0c95bfcd: Pull complete
Digest: sha256:ae007bdb45fc0d56e3d705b97640ac24844bcc9ce4c8b8493f216a57ab6af0d5
Status: Downloaded newer image for busybox:latest
panic: standard_init_linux.go:175: exec user process caused “exec format error” [recovered]
panic: standard_init_linux.go:175: exec user process caused “exec format error”

goroutine 1 [running, locked to thread]:
panic(0x7bcaa0, 0x4820161ce0)

sles13

Installing Docker 1.13 on 64-bit ARM OS:

Docker doesn’t officially support AARCH64 system. You can’t use one-liner command to install Engine 1.13 as shown below:

Untitled picture

If you really want to try 1.13, the easier way is downloading it from the below link:

sles25

Installing docker-compose

linux:~ # zypper install python-pip

linux:~ # pip install docker-compose

sles19
Tested docker-compose v2.0 functionality by bringing up microservices and it went fine.

sles66

Testing Swarm Mode:

sles100

sles90

linux:~/collabnix # docker service ls
ID            NAME        REPLICAS  IMAGE          COMMAND
0x7dlmr4pjm7  backend-db  1/1       aarch64/redis

linux:~/collabnix # docker service ps backend-db
ID                         NAME          IMAGE          NODE   DESIRED STATE  CURRENT STATE                 ERROR
7jmkwcbzq8wix3umfkcqc92rw  backend-db.1  aarch64/redis  linux  Running        Preparing about a minute ago

 

Assessing the current state of Docker Engine & Tools on Raspberry Pi

Estimated Reading Time: 7 minutesAre you planning to speak or conduct your next Docker Workshop on Raspberry Pi’s? Still curious to know whether the tools like Docker Machine, Docker Compose, Dockerfile, 1.12 Swarm Mode, High Availability & Load Balancing are compatible and good to be demonstrated to the workshop audience? In case you want to know the current state of Docker containers on Raspberry Pi, then you are at the right place. For the next 1/2 hour time, I will be talking about what Docker images, tools, networking and security features are supported on Raspberry Pi box.

Let’s have a quick glimpse of what popular tools works today with Docker Engine on Pi box. Below listed are few lists of tools and applications which currently works great on Raspberry Pi. Please remember that this is NOT official support Matrix from Docker Inc. Also, the versions specified are the latest tested and verified personally. I just verified the tools functionality so as to keep it ready before the workshop.

rasp2

The  State of Docker Engine

In my previous blog post, I talked about “Docker 1.12.1 on Raspberry Pi 3 in 5 minutes” where I demonstrated on how to get started with Docker 1.12.1 Installation on Pi box for the first time. With 1.12.1, a FIRST ARM Debian package was officially made available and there was tremendous amount of interest among the Docker users. This time I tried my hands with the latest experimental build, Docker Engine version 1.12.3 on top of the latest Raspbian Jessie Lite version.

pi1

pi2

pi3pi5

Docker Engine looked quite stable as I was able to try out basic Docker commands like exec, run, attach etc., creating Dockerfile and building the image was smooth on Pi box. Running and stopping the containers works as smooth as you experience on VMs on your Virtual box or Cloud instance. This release should be a good baseline for demonstration of the latest Docker CLI to the workshop audience(for both beginners & advanced level users)

The State of Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services.Major features like multiple isolated environments on a single host, building up Microservice architecture makes Compose a powerful tool. I picked up the latest stable Docker Compose version 1.8 so as to check and verify the latest compose functionality.

pi8

I followed this link to get Docker Compose version 1.8 installed on my Pi box. It went smooth and required no tweaking at all. I tried running WordPress application(running maria-db, Apache and PHP) inside docker containers using docker-compose and it just went fine.

pi12

rpi13

rpi14

rpi16

rpi19

The overall experience with Docker Compose was positive. Tried dozens of docker-compose CLIs like exec and run and it worked great. In case you are planning to demonstrate Compose 1.8, go ahead and this should be a great tool to demonstrate the concept of Microservices to the workshop users.

The State of Docker 1.12 Swarm Mode

I verified the functionality of Swarm Mode on Docker 1.12.3 and it just works flawless. I tested the basic functionality in setting up the master and worker nodes and it worked great:

rpi1

One just need to add the worker nodes as suggested in the above command and it just worked as expected. I tried few features like workers leaving the cluster using $docker swarm leave option and it worked as expected. Creating networks and attaching services to the overlay network is one feature which I haven’t yet tried out. Will update this space once I try my hands-on with the overlay network.

The State of Docker 1.12 High Availability:

Demonstrating HA using Swarm Mode is always an interesting stuffs to do with the container clustering.  I had 5 nodes clustering setup with 5 Raspberry Pi – one master and other 4 worker nodes. I took the same WordPress application and demonstrated on 5 node cluster. I scaled out the WordPress application container from 10 to 30 and then tried stopping few containers on the 3rd Pi. Automatically the new containers came up with a new IDs balancing across the swarm cluster. I haven’t tested the master node failure on Pi box but I believe it should work with minimal 3 number of master nodes on Raspberry Pi boxes.

The State of Operating Systems Docker Image:

Last September, I built the first CentOS 7.2 ARM docker image on Raspberry Pi 3 which I described in detail through my blog. It was well appreciated effort and quite accepted by Docker community. I was trying to build Dell legacy application for ARM architecture and the legacy application was tightly coupled to CentOS 7.x distribution. Hence, just thought to pick up necessary packages from Fedora repository and successfully built the required CentOS 7.2 Docker image. Other than CentOS, Ubuntu, Alpine Linux and Arch-Linux are few of the most popular Docker OS image which can be demonstrated to the workshop audience.

rpi30

The State of Tools(Monitoring, Management):

Two months back, I published a blog post on “Turn Your Raspberry Pi into Out-of-band Monitoring Device using Docker“. I pushed Nagios Docker image for the first time for ARM architecture which you can use freely from Dockerhub. Demonstrating the monitoring tool like Nagios running inside Docker on Raspberry Pi can be a great example of how Docker reduces the complexity in packaging the huge application.

Talking about UI & Management of Docker containers, I came across Portainer – A Simple Management UI for Docker .Portainer is very young project but gaining a huge popularity due to its easy to use UI, lightweight and responsive user interface.

[Updated: 11/21/2016] – Good News for Pi users – Portainer now has official support for ARM arch using the Docker image portainer/portainer:arm ! Portainer recently added more features to support swarm mode services in their latest release.

Setting up Portainer is a matter of one-liner command(as shown below):

  port1

That’s it. All you need to do is open your browser and point out to http://<IP>:9000.Portainer provides you a lightweight management UI which allows you to easily manage your Docker host or Swarm cluster.

port2

One of the most attractive offering from Portainer Team is “Use Your Own Templates” . It allows you to rapidly deploy containers using App Templates, a glimpse of which can be found at https://raw.githubusercontent.com/portainer/templates/master/templates.json.

port3

In short, Portainer allows you to manage your Docker containers, images, volumes, networks and more ! It is compatible with the standalone Docker engine and with Docker Swarm.

In my future blog post, I am going to touch upon the upcoming Docker releases verified for Raspberry Pi box and its compatibility matrix. Feel free to share your thoughts through twitter(@ajeetsraina)

[clickandtweet handle=”@docker @ajeetsraina” hashtag=”#RaspberryPi #docker ” related=”@Raspberry_Pi” layout=”” position=””]Run Your Next Docker Workshop on Raspberry Pi[/clickandtweet]