TL;DR Useful docker commands to have in your arsenal.
So far we’ve seen the basic functionality of Docker, had a detailed look on Dockerfiles, and common commands used to
manage/view/build/share containers and images.
In this post, I am going to try to gather some other useful Docker commands that will make our life easier operating dockerized systems.
Usefull Docker Commands
In the previous 2 parts, we ’ve already seen:
docker ps &
docker ps -a
So I’ll move forward to other more sneaky commands.
Quite self-explanatory, shows the currently installed version.
Used to delete docker images. More or less similar to
docker rm but for images instead of containers.
This command is used to execute a command on a running container. The most common use case is to access a running container to debug something.
docker exec -it <cotnainer_id> bash
Used to get detailed low-level information on Docker objects like containers and images. If you are looking for details like Ip addresses, volumes, stuff around networking, image layers, etc this should be your first place to look.
Quite self-explanatory, restarts a docker container.
docker system prune
Used for housekeeping and cleaning in order to remove all unused containers, networks, and images, combine with
--volumes to clean volumes too.
Display the running processes of a container.
Manage volumes by combining with the subcommands
Get a live stream of resource usage of your running containers. Quite useful for debugging purposes as it shows info about CPU, Mem, Net I/O, Block I/O , Pids.
Manage docker networking by combining with the subcommands
Check the next part regarding Docker Storage here