Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Using Docker

1 Installing Docker

The first step is to install docker on the Raspberry Pi. It is assumed you have already set up your Raspberry Pi using the instructions in the Getting Started worksheet.

The simplest way to install Docker is to use the apt package manager. We search for the software we want, check the details and then install:

$ sudo apt update
  Fetched 13.0 MB in 1min 8s (191 kB/s)                                                                                        
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
$ apt cache search docker
  docker - transitional package
  docker-compose - Punctual, lightweight development environments using Docker
  docker-swarm - Docker\'s native clustering system
  docker.io - Linux container runtime
$ apt-cache policy docker.io
  docker.io:
    Version table:
    *** 18.09.1+dfsg1-7.1+rpi1 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
        100 /var/lib/dpkg/status
$ sudo apt install docker.io
$ docker --version

Once the software is installed, lwe should test the setup with the Docker equivalent of "hello world"

$ docker run hello-world
  Unable to find image 'hello-world:latest' locally
  latest: Pulling from library/hello-world
  c1eda109e4da: Pull complete 
  Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f
  Status: Downloaded newer image for hello-world:latest

  Hello from Docker!

1.1 Test Your Understanding

You will also need to install:

  1. Docker Compose
  2. Docker Swarm

Use the commands from the installation of the Docker container runtime to find the names of the packages in the repository, check their versions and install.

2 Deploying Containers

  • using existing image as a base
  • deploy to the Rpi