Skip to main content
  1. September/

Installing Docker on Ubuntu Hosts

Installing Docker on Ubuntu Hosts #


Quick navigational links:


This taken from [Docker’s instructions for installing Docker][dockersInstructions]

Pre-Requisites #

Remove any existing versions #

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

Methods #

Installing from the repo #

Setup the repository #

Update and prep #

Update the apt package index and install packages to allow apt to use a repository over HTTPS:

apt-get update
apt-get -y install apt-transport-https ca-certificates curl gnupg lsb-release
  • Add Docker’s GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Add the repository to your system #
  • Generate and add the apt repo artifact for your architecture:
amd64
Instructions

echo "deb [arch=amd64 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

armhf
Instructions

echo "deb [arch=armhf 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

arm64
Instructions

echo "deb [arch=arm64 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

Install the dockery goodness #

Update the apt package index, and install the latest version of Docker Engine and containerd,

apt-get update
apt-get install docker-ce docker-ce-cli containerd.io

if you wish to be pedantic:

apt-get install containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin pigz slirp4netns
```##### To install a specific version

To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

a. List the versions available in your repo:
apt-cache madison docker-ce

b. Install a specific version using the version string from the second column, for example

apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io



### Installing via a package

### convienience script

Custom tweaks

/etc/docker/daemon.json
: `{
  "log-driver": "journald"
}`

in conjunction with a `/etc/systemd/journald.conf` config like so:

[Journal] Storage=volatile ForwardToSyslog=yes Compress=no SystemMaxUse=auto SystemMaxFileSize=10M SystemMaxFiles=100 RuntimeMaxFileSize=10M RuntimeMaxFiles=100


----


[dockersInstructions]: <https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository>