Step 2: Docker Installation
Step 2: Docker Installation#
Duckietown uses DockerHub to distribute the containerized version
of its software modules, and most Duckietown procedures entail some docker
operations behind the scenes.
If you are unfamiliar with Docker, we strongly recommend reading the following reference page to gain a working understanding of this tool: The Duckietown Intro to Docker
Note
A free Docker account is sufficient for our purposes.
1) Install Docker
Install Docker by first ensuring that you don’t have older versions of Docker on your system
sudo apt-get remove docker docker-engine docker.io containerd runc
Then set up the apt repository containing Docker
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg
Add the official GPG key
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
And set up the repository with
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Finally, update again and install Docker Engine and Docker Compose
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo apt-get install docker-compose
2) Set up Docker
Start by adding the user “docker” to your user group, then log out and back in
sudo adduser `whoami` docker
Attention
You need to reboot your computer for this change to take effect. Until you do, an error will be shown for most of the steps that follow.
Checkpoint ✅
Now make sure that Docker was correctly installed by running the following tests
Test
docker --version
docker buildx version
Expected Result
Make sure the Docker version is v1.4.0+
and buildx
version v.0.8.0+
Test
Start the hello-world
image with
docker run hello-world
Expected Result
You should see a message like Hello from Docker!
1) Install Docker
Follow these instructions to install Docker on macOS.
Attention
If you are using Docker Desktop for Mac, you will need to specify the amount of memory usable by Docker to run the Duckietown containers. Navigate to the Settings (gear icon in top right corner of the Docker app). Select the Resources tab and use the slider to confirm that the Memory Limit is >4.5 GB.
Checkpoint ✅
Now make sure that Docker was correctly installed by running the following test.
Test
Start the hello-world
image with
docker run hello-world
Expected Result
You should see a message like Hello from Docker!
Troubleshooting
SYMPTOM
If just installed and/or signed up for Docker, you may encounter an authorization issue like this:
bash Unable to find image 'hello-world:latest' locally docker: Error response from daemon: failed to resolve reference "docker.io/library/hello-world:latest": failed to authorize: failed to fetch oauth token: unexpected status from GET request to https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: 401 Unauthorized
RESOLUTION
There is/may be a bug with login authentication with Docker Hub.
Force a re-login by entering:
bash docker login -u [YOUR DOCKER USERNAME]
You will then need to enter your docker account password and, assuming correct login, be rewarded with Login Succeeded
.
Attempt to run the hello-world
container again.
1) Install Docker
Follow these instructions to install Docker on WSL.
Checkpoint ✅
Now make sure that Docker was correctly installed by running the following test.
Test
Start the hello-world
image with
docker run hello-world
Expected Result
You should see a message like Hello from Docker!
Troubleshooting
SYMPTOM
I cannot start Docker from my WSL distribution.
RESOLUTION
Make sure you have WSL support for Docker enabled by following these instructions.