Installation Set up for Linux Distros : Ubuntu, Debian, CentOs
sudo apt-get update && sudo apt-get upgradesudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below. Learn about nightly and test channels.
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
sudo apt-get install -y docker.ioCheck if the docker engine is installed successfully and version installed
docker -v Run Hello world app to check if docker engine is up and running
sudo docker run hello-worldThis command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.
sudo apt-get install -y docker.io#Remove all containers, images and volumes from directory
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerdRun this to build Dockerfile
docker build -t node-app:1.0 .sudo docker images Download docker images from Docker Hub Registry
docker run <ImageName>Display all docker images within the system
docker imagesDisplay all docker images ID within the system
docker images -qShow more details about an image
docker inspect <ImageName>To delete a docker image
docker rmi <ImageID>List all running containers within the system
docker psList all containers within the system
docker ps -a Get all commands run against the docker image
docker history <ImageID>
OR
docker history <ImageName>
View top processes within the container
docker top <ContainerId>Stop docker container from running
docker stop <ContainerId>Delete docker container
docker rm <ContainerId>Pause a running docker container
docker pause <ContainerId>Unpause a running docker container
docker pause <ContainerId>Start docker service
sudo service docker start Stop docker service
sudo service docker stop