Installing docker on Ubuntu 22

Installing docker on Ubuntu 22

First version: 2023-11-24
Last version: 2024-01-12
Last change: Small corrections to reflect that domain allowlisting is now a self-service feature.

This is a community effort. The article was created through collaboration of the anDREa Support Team and Amsterdam UMC Support Team in their spare time. If you have found a more efficient way to approach this, please contact us and we will update the article.

Introduction

Docker is a platform designed to help developers build, share, and run container applications. Below we describe how to install docker on an Ubuntu 22 VM.

Requirements

  1. An Ubuntu 22 VM 
  2. Access to the domains below.
  3. Privileges in the Workspaces: Advanced Member or above.

Domain allowlisting

For docker to work, domain allowlisting is required.  Domain allowlisting is a self-service feature for Accountable and Privileged Members and can be initiated from the External Access tab in the Workspace.

The following domains are needed:
    1. azure.archive.ubuntu.com (needed for sudo apt-get update)
    2. packages.microsoft.com (needed for sudo apt-get update)
    3. docker.com (needed for pulling docker containers)
    4. docker.io (needed for pulling docker containers)
    5. 6aa30f8b08e16409b46e0173d6de2f56.r2.cloudflarestorage.com
    6. OPTIONAL: huggingface.co (Some docker containers also have to download certain models hosted on huggingface.co)
    7. OPTIONAL: Docker maintains their own list of domains to allow, these are not all needed though.

Docker installation steps

  1. Follow the instructions under Install using the apt repository until the part where it asks you to test run the Hello World docker.
  2. Type the following command:
  1. sudo nano /lib/systemd/system/docker.service 
  1. Within the [Service] section, type:
  1. EnvironmentFile=/etc/environment

  1. Save the file with CTRL+X, CTRL+Y and ENTER.
Install docker compose to run .yml file
sudo apt-get install docker-compose-plugin or this command if it does not work sudo apt install docker-compose
  1. Restart docker with the following commands:
  1. sudo systemctl daemon-reload
  2. sudo systemctl restart docker
  1. Test run the Hello World docker with:
  1. sudo docker run hello-world


Pulling and running docker containers

  1. For pulling a docker container, use the command:
  1. sudo docker pull [docker name]
  1. Replace [docker name] with the name of the docker container.
  1. For running a docker container, use the command:
  1. sudo docker run [docker name]
  1. If you're experiencing timeouts or the error urllibs3 ProxySchemeUnknown, the following command might solve it:
  1. sudo docker run -e HTTP_PROXY=http://11.5.0.4:3128 -e HTTPS_PROXY=http://11.5.0.4:3128 [docker name]