We can easily install docker using a shell script provided by (none other than) docker.
curl -sSL https://get.docker.com | sh
If you prefer to inspect scripts before executing them, you can split this command into two pieces:
curl -sSL get.docker.com -o get-docker.sh # Make sure get-docker.sh looks right sh get-docker.sh
If you try to run some docker commands, you'll notice a "permission denied" error, which indicates docker can only be run by the root user (using
sudo). If you would like to run docker commands as your non-root user (default is
pi), you can run the following:
sudo usermod -aG docker pi
usermod command with
-aG will append (-a) the user to the groups (-G). In the above case, we are adding the
pi user to the
docker group. This enabled
pi to run docker commands. You can obviously substituted any user if you are not using the default
You can verify this with the following command:
docker is listed as one of the groups.
To test docker, we'll run the hello-world image.
docker run hello-world
If Docker is installed properly, you'll see a "Hello from Docker!" message.
docker-compose is a tool that lets you define and manage your infrastructure using YAML configuration files. It's especially useful when your application requires multiple interdependent services.
docker-compose on your Raspberry Pi, you can use the
sudo pip3 -v install docker-compose