How to install docker in ubuntu 16.04 and Amazon Linux

Firstly update ubuntu repository by running following command

sudo apt-get update -y && sudo apt-get upgrade -y

Now install packages pt-transport-https, software-properties-common and ca-certificates

sudo apt-get install apt-transport-https software-properties-common ca-certificates -y

Now get the gpg key

wget && sudo apt-key add gpg

Add docker repository:

sudo add-apt-repository "deb [arch=amd64] bionic stable"

If the above step succeded, you are good to install docker

sudo apt-get install docker-ce -y

Once the installation completed, you may need to start docker service.

sudo systemctl start docker && sudo systemctl enable docker

To run docker without sudo, you will need to create a user for docker and add the users into that group

sudo groupadd docker && sudo usermod -aG docker dockeruser

The user ubuntu will be able to run docker commands without sudo now.

For rhel based OS, use the following commands to install and start docker.

yum install -y docker-io
service docker start

Post navigation

Alvin Jaison

Myself Alvin Jaison. I'm a DevOps Engineer by Profession; A Mountaineer by Passion. I started this website to share DevOps related posts. Post your suggestions as a comment. You can reach me @

2 thoughts on “How to install docker in ubuntu 16.04 and Amazon Linux

Leave a Reply

Your email address will not be published. Required fields are marked *