I have spent some time to gather list of most used docker commands and below is a summary for same. These are not full blown commands, just to get you started and then you can use inbuilt command help.
Lifecycle
- docker create Creates a container
- docker rename Renames a container
- docker run Creates and runs a container
- docker rm Removes a container
- docker update Updates a container resource limits
Starting/stopping a container
- docker start Starts a container
- docker stop Stops a container
- docker restart Stops and starts a container
- docker pause Pauses a running container
- docker unpause Unpause a running container
- docker wait Blocks until running container stops
- docker kill Sends a SIGKILL to a container
- docker attach Connects to a running container
Container resource constraints
- docker run -it –c 512 {Container_name} Sets the container to 50% usage of the available CPU cores. The value 512 specifies 50%, whereas changing the value to 1024 specifies 100%
- docker run -it -m 100M {Container_name} Sets the container to have a memory limit of 100M
Container information
- docker ps Shows the running containers
- docker ps -a Shows the running as well as previously ran containers
- docker logs Gets logs from a container
- docker inspect Looks at all the information on a container
- docker events Gets event information from a container
- docker port Shows the public-facing port of a container
- docker top Shows running processes in a container
- docker stats Shows the resource usage statistics for a container
- docker diff Shows changed files in the containers file systems
Images
- docker images Shows all the images on the container host
- docker build Create an image from a Dockerfile
- docker commit Creates an image from a container
- docker rmi Remove an image from a container host
- docker history Shows all the history of image
- docker tag Tags an image to a local host or registry
- docker pull Pull the image from a registry
- docker search Search a image from docker hub
- docker push Push an image to a registry
- docker save Archive an image as tar file
Network
- docker network create Creates a network for a container
- docker network rm Removes a network
- docker network ls Lists all networks
- docker network inspect Display all info in relation to the network
- docker network connect Connects a container to a network
- docker network disconnect Disconnects a container from a network
Registry
- docker login Login to docker registry
- docker logout Logout from registry