Install Docker on Ubuntu 16.04

in docker •  7 years ago  (edited)

What is Docker?

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they're running on and only requires applications be shipped with things not already running on the host computer.


Installing Docker through Terminal(Ubuntu 16.04)

1.  Add the GPG key for the official Docker repository to the system

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



2. Add the Docker repository to APT sources

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"



3. Update the package database with the Docker packages from the newly added repo

$ sudo apt-get update



4. Check the installed Docker repo 

$ apt-cache policy docker-ce



5.  Install Docker

$ sudo apt-get install -y docker-ce




6.  Check docker is running 

$ sudo systemctl status docker



7.  To check whether you can access and download images from Docker Hub.

$ docker run hello-world


Extra commands 

Listing Docker Containers

$ sudo docker ps



 Docker Status - return the live data stream for running containers.

$ sudo docker stats



Search for images available on Docker Hub

$ sudo docker search image_name



Download docker image from Docker Hub

$  sudo docker pull image_name



List all containers (only IDs) 

$ sudo docker ps -aq



Stop all running containers 

$ sudo docker stop $(docker ps -aq)



Remove all containers

$ sudo docker rm $(docker ps -aq)



Remove all images

$ sudo docker rmi $(docker images -q)




Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!