Install Docker

Install Docker

Follow the official guide to installing Docker Engine.

There is also an official installer script you may run:

  • On the pi, install docker:
Run this on the Raspberry Pi
curl -sSL https://get.docker.com | sh
  • Test that docker is working:
Run this on the Raspberry Pi
sudo docker run hello-world
  • If it’s working, you should see a Hello from Docker! message and some other help info.
Tip

Normally, you shouldn’t use sudo docker. In the next section you will create a Docker context for the pi user to use directly.

Set up Docker context (SSH)

d.rymcg.tech requires the use of a Docker context via SSH, rather than the default socket context.

Create a new docker context, named pi, using the SSH config you had just created (also called pi):

Run this on the Raspberry Pi
docker context create pi --docker "host=ssh://pi"

Switch to use the new SSH context as the default:

Run this on the Raspberry Pi
docker context use pi

Now, when you run any docker command, it will use the SSH context:

Run this on the Raspberry Pi
docker info | grep -iE "(Name|Context)"

This should print the proper context: pi.

If it worked, the pi user is now fully equipped to run any docker comamnd as root.