Steps to get docker installed on Ubuntu 18.04. These steps are taken from the official documentation (see here for more details):
- Update the apt package index
- Install packages to allow apt to use a repository over HTTPS
- Add Docker’s official GPG key
- Set up the stable repository
- Update the apt package index (again)
- Install the latest version of Docker CE
- Test the installation
# Step 1: Update the apt package index
sudo apt-get update
# Step 2: Install packages to allow apt to use a repository over HTTPS
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
# Step 3: Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Step 4: Set up the stable repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Step 5: Update the apt package index (again)
sudo apt-get update
# Step 6: Install the latest version of Docker CE
sudo apt-get install docker-ce
# Step 7: Test the installation
sudo docker run hello-world
For simplicity I have not set users and roles, so every time I want to run docker commands I need to start the command with ‘sudo’.
Example use:
# Start docker daemon
sudo service docker start
# Do something
sudo docker version
# Stop docker daemon
sudo service docker stop