Install Docker on Ubuntu
2 min readJan 18, 2024
Docker is an open-source containerization platform by which you can pack your application and all its dependencies into a standardized unit called a container. Containers are light in weight which makes them portable and they are isolated from the underlying infrastructure and from each other container. You can run the docker image as a docker container in any machine where docker is installed without depending on the operating system.
Docker is popular because of the following:
- Portability.
- Reproducibility.
- Efficiency.
- Scalability.
Step 1: Remove any docker installation if you have
sudo apt-get remove docker docker-engine deocker.io
Step 2: Install docker
sudo apt-get update
sudo apt-get install docker-ce
OR
sudo apt install docker.io
sudo snap docker install
Step 3: Check if docker is successfully installed in your system
docker --version
sudo docker run hello-world
Step 4: Docker Image
sudo docker images
OUTPUT
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d2c94e258dcb 8 months ago 13.3kB
Step 5: To view all containers
sudo docker ps -a
OUTPUT
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1096276749f4 hello-world "/hello" About a minute ago Exited (0) About a minute ago jovial_ishizaka
Step 6: To view the latest container you created
sudo docker ps -l
OUTPUT
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1096276749f4 hello-world "/hello" About a minute ago Exited (0) About a minute ago jovial_ishizaka
Reference Video