Install Docker in Linux ubuntu | sudo apt install docker.io |
Check Docker Status | sudo systemctl status docker |
It provides all the information of docker, and also use to check it is installed or not. | docker info |
It will show a list of commands that available for us with a short description of what it does. | docker –help |
It will show help particularly for command with a short description of what it does. | docker “cmd” –help |
If an image will not available locally it will first download form the network then it will make and run the container and detach from it. | docker run “Image Name” |
If the image will not available locally it will first download form the network then it will make and run the container and keep it attached on it. | docker run -it “Image Name” |
It will open the existing container which is running. | docker attach “container id” |
Get in the bash terminal within a container | docker exec -it “container id” /bin/bash |
It shows only running containers. | docker ps |
It shows all the containers are available in docker | docker ps -a |
It shows images are available locally in the docker | docker images |
It deletes the container with a given container id | docker rm “Container id” |
It deletes the images which any container is not containing | docker rmi “Image id” |
It deletes the images forcefully could container contain | docker rmi “Image id” –force |
Download the image | docker pull “Image Name” |
To see all the running processes in Linux | ps -elf(For Linux) |
It will show all the running processes in the container | docker top “container id” |
Remove all container (stop container before remove) | docker container prune |
Stop Docker | docker stop “container id” |
To detach from the container without closing the container. | Ctl+p then Ctl+q |
Check changes in container | docker diff “container id” |
Check history | docker history “container id” |
It will show all the commands that were associated with this Container id. | docker logs “container id” |
Show running container all details (Ex: IPAddress) | docker inspect “container id” |
Run docker and Bind mount a volume ( copy all project in docker)
docker run -dit -v source_folder:destination_folder “container id”
Example: docker run -dit -v /var/www/html:/var/www/html “container id”
-d, –detach Run container in background and print container ID