Docker Configuration Scripts
Updated: 03 September 2023
Docker Configuration Scripts
Ubuntu
Run the following as sudo
on an Ubuntu VM or WSL as per the instructions on the Docker CE site
1sudo apt-get update2sudo apt-get install \3 apt-transport-https \4 ca-certificates \5 curl \6 gnupg-agent \7 software-properties-common -y8curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -9sudo apt-key fingerprint 0EBFCD8810sudo add-apt-repository \11 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \12 $(lsb_release -cs) \13 stable"14sudo apt-get install docker-ce docker-ce-cli containerd.io -y15sudo docker run hello-world
WSL
Note that WSL cannot independantly run the Daemon, but you can connect to the instance of Docker Daemon on your Windows system
1# Update the apt package list.2sudo apt-get update -y3
4# Install Docker's package dependencies.5sudo apt-get install -y \6 apt-transport-https \7 ca-certificates \8 curl \9 software-properties-common10
11# Download and add Docker's official public PGP key.12curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -13
14# Verify the fingerprint.15sudo apt-key fingerprint 0EBFCD8816
17# Add the `stable` channel's Docker upstream repository.18#19# If you want to live on the edge, you can change "stable" below to "test" or20# "nightly". I highly recommend sticking with stable!21sudo add-apt-repository \22 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \23 $(lsb_release -cs) \24 stable"25
26# Update the apt package list (for the new apt repo).27sudo apt-get update -y28
29# Install the latest version of Docker CE.30sudo apt-get install -y docker-ce31
32# Allow your user to access the Docker CLI without needing root access.33sudo usermod -aG docker $USER
Lastly in order to tell WSL where your Docker Daemon is running (assuming you’ve exposed it from Docker Desktop on Windows) you need to run the following
1docker -H localhost:2375 images