Skip to content

Latest commit

 

History

History
167 lines (90 loc) · 4.22 KB

how-to-install-docker.md

File metadata and controls

167 lines (90 loc) · 4.22 KB

Docker installation on

1. Install docker on Ubuntu 20.04

  1. First, update your existing list of packages:

sudo apt update

  1. Next, install a few prerequisite packages which let apt use packages over HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

  1. Then add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

  1. Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

  1. Next, update the package database with the Docker packages from the newly added repo:

sudo apt update

  1. Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce

  1. Finally, install Docker:

sudo apt install docker-ce

  1. Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it's running:

sudo systemctl status docker

  1. If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

sudo usermod -aG docker ${USER}

  1. Logout and login again. Now you will be able to run docker commands as the user

2. Install docker on Ubuntu 18.04

  1. First, update your existing list of packages:

sudo apt update

  1. Next, install a few prerequisite packages which let apt use packages over HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

  1. Then add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

  1. Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

  1. Next, update the package database with the Docker packages from the newly added repo:

sudo apt update

  1. Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce

  1. Finally, install Docker:

sudo apt install docker-ce

  1. Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it's running:

sudo systemctl status docker

  1. If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

sudo usermod -aG docker ${USER}

3. Install docker on CentOS 7

  1. Run update

yum update -y

  1. Add the yum repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
  1. Install the Docker package.

sudo yum install -y docker-engine

  1. Enable the service.

sudo systemctl enable docker.service

  1. Start the Docker daemon.

sudo systemctl start docker

  1. If you want to be able to use docker from a non root user run below command from that user (note that this user needs sudo privilege)

sudo usermod -aG docker $(whoami)

  1. Logout and login again

  2. Now you can start using docker as the user

4. Install docker on Amazon linux

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html

  1. Run update

yum update -y

  1. Install the most recent Docker Engine package.

If using Amazon Linux 2 run below command

sudo amazon-linux-extras install docker

If using Amazon Linux run below command

sudo yum install docker

  1. Install Docker

sudo yum install docker

  1. Start the docker service

sudo service docker start

  1. Set permissions for user to use docker commands

sudo usermod -a -G docker ec2-user

5. Install docker on Windows

Follow the steps provided here to install Docker Desktop on Windows