0% found this document useful (0 votes)
9 views2 pages

Docker Installation Steps

This document provides a step-by-step guide for installing Docker on Ubuntu, including prerequisites and commands for installation and usage. It details commands for checking Docker status, running containers, managing images, and pushing images to Docker Hub. Additionally, it includes examples of committing changes to images and tagging them appropriately.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Docker Installation Steps

This document provides a step-by-step guide for installing Docker on Ubuntu, including prerequisites and commands for installation and usage. It details commands for checking Docker status, running containers, managing images, and pushing images to Docker Hub. Additionally, it includes examples of committing changes to images and tagging them appropriately.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

To install a docker, build a container and use, Run the following commands one by one

Prerequisites
1. sudo apt update
2. sudo apt install apt-transport-https ca-certificates curl software-properties-common
3. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o
/usr/share/keyrings/docker-archive-keyring.gpg
4. 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

Commands to install & use docker


5. sudo apt update - update ubuntu

sudo apt-cache policy docker-ce- show whether the docker is installed, which version is available from
which repository.

sudo apt install docker-ce - install docker

6. sudo systemctl status docker - to check the current status of the docker
7. sudo docker - list the docker commands and its use
8. sudo docker info - details about the docker

sudo docker run hello-world - run hello-world image to verify the installation

9. sudo docker search ubuntu


10. sudo docker pull ubuntu
11. sudo docker images
12. sudo docker run -it ubuntu
13. sudo docker ps (ps –a, ps –l) - ps command lists containers
14. sudo docker start containerid/name - start a container
15. sudo docker start –i containerid/name - start a container in interactive mode
16. sudo docker stop containerid/name - stop a container
17. sudo docker rm containerid/name - remove a container

sudo docker commit -m "What you did to the image" -a "Author Name" container_id
repository/new_image_name - to save the changes to the image
18. sudo docker images
19. sudo docker tag imagename:latest image-name:newtag - to change the tag
20. sudo docker login -u docker-registry-username - login to docker hub
21. sudo docker push docker-registry-username/docker-repository:docker-image-name
- pushing the created image to docker hub

sudo docker push leenanamboothiri/leena:lee_image

sudo docker commit -m "installed gcc and vi" -a "leena" container_id


leenanamboothiri/lee_image

sudo docker commit -m "installed python3" -a "leena" fef37de35965 lee_image

sudo docker tag leenanamboothiri/lee_image:latest leenanamboothiri/leena:lee_image – to


change the tag

docker push leenanamboothiri/leena:tagname

sudo docker tag s1_container:latest ananthasivan/ravi:p1.png

You might also like