Install Docker on Linux command line, fast!

This works as of date published on Ubuntu desktop. This is all assimilated from here and here – just a note for me and anyone who wants a real quick install!


- Preamble and install prerequisites
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release

- Add key & stable repo
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

- Install docker stable
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

- If you don’t want to preface the docker command with sudo, create a Unix group called docker and add users to it
sudo groupadd docker
sudo usermod -aG docker $USER

- Non-debian based systems need to start the daemon
sudo systemctl enable docker.service
sudo systemctl enable containerd.service

- Verify
sudo docker run hello-world

Profit!

Blog Tags: DockerLinux

Add new comment