Hey there! I am Palak. I like writing technical blogs and sharing my knowledge with the community. I am passionate about Cloud & DevOps. I am writing this blog to share the Docker commands that I mostly use.
Docker was released as an open-source project in 2013. Docker enables developers to easily pack, ship, and run any application as a lightweight, portable, self-sufficient container, which can run anywhere. Docker is an application that simplifies the process of managing application processes in containers.
Containers let you run your applications in resource-isolated processes. Theyre similar to virtual machines, but containers are more portable, more resource-friendly, and more dependent on the host operating system.
So, let's get started.
Docker version
This command is used to find a version of Docker
docker --version
List docker containers
This command list the running containers
docker ps
List all docker containers
This command lists all the running and exited containers
docker ps -a
List docker Images
This command lists all the locally stored docker images
docker images
Start container
This command is used to start a container that has been stopped
docker start <container id>
Stop container
This command stops a running container
docker stop <container id>
Create docker image
This command creates a container from an image
docker run <image name>
Remove docker image
This command deletes an image from local storage
docker rmi <image id>
Remove docker container
This command deletes a stopped container
docker rm <container id>
Pull image
This command pulls images from the docker repository
docker pull <image name>
Docker commit
This command creates a new image of an edited container
docker commit <container id> <username/image name>
Access running container
This command is used to access the running container
docker exec <container id> cat /etc/os-release
Push docker image
This command is used to push an image to the docker hub repository
docker push <username/image name>
Inspect container
This command will list the complete information of the container
docker inspect <container id>
Container Logs
This command will list the complete information of the container
docker logs <container-name or container-id>
Restart docker container
This command is used to restart one or more containers
docker restart <container id>
Login docker hub
This command is used to log in to the docker hub
docker login
Kill container
This command is used to kill the container by stopping its execution
docker kill <container id>
List processes of a container
This command is used to list the running processes of a container
docker top <container id>
Live stream of container
This command is used to display a live stream of container resource usage statistics
docker stats <container id>
Thank you for reading my blog. I hope you find it useful. If you enjoyed this post, feel free to follow me on Twitter π©π»
Top comments (0)