CHENGJIE FANG / RESEARCH ARCHIVEUCAS 2026.11
← Field notes

Field note

Installing Docker on an Ubuntu GPU Server

The package, repository, service, and shell-completion steps from my Ubuntu Docker setup.

This is the Docker installation sequence I recorded on an Ubuntu GPU server in November 2024. Although the original note’s title mentioned having no sudo access, the system-package and service commands below require an administrator or a root shell. They are not a rootless Docker installation procedure.

Remove conflicting packages

On a machine being prepared for this installation, I first removed the older Docker packages:

sudo apt-get remove docker docker-engine docker.io containerd runc

Package names vary by Ubuntu release; these are the names in the original setup.

Add the repository

Install the tools needed for HTTPS repositories and key handling:

sudo apt install apt-transport-https ca-certificates curl \
  software-properties-common gnupg lsb-release

Choose one repository source. For Docker’s official repository:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
  | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
  | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

When access to the official host was unreliable, I used the Aliyun mirror instead:

curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg \
  | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" \
  | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Both examples write the same source file; use the one appropriate to the installation, then refresh the package index:

sudo apt update

Install and inspect Docker

sudo apt install docker-ce docker-ce-cli containerd.io
docker version
sudo systemctl start docker
systemctl status docker

Starting Docker does not by itself configure NVIDIA GPU support; this note covers the base Docker installation.

Shell completion

I installed Bash completion and loaded Docker’s completion script:

sudo apt-get install bash-completion
sudo curl -L \
  https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker \
  -o /etc/bash_completion.d/docker.sh
source /etc/bash_completion.d/docker.sh

That script URL belongs to the repository layout used in the original note. If it has moved, use the completion support supplied by the installed Docker package.

Research figure