Docker Commands Cheatsheet

Devrel manager cerbos.dev
Search for a command to run...

Devrel manager cerbos.dev
No comments yet. Be the first to comment.
Learn DevRel today! 1. Introduction to Developer Relations (DevRel) Developer Relations, commonly known as DevRel, is a multifaceted discipline that serves as a crucial bridge between technology companies and the developer community. It encompasses ...
Introduction Configuration-as-Code(CaC) is a common and powerful buzzword in DevOps and Cloud Native. Rather than manually creating configurations from Graphical User Interface(GUI), It allows managing your system’s configuration settings by presenti...
Being an open-source promoter, I have been actively contributing to open-source, which helped me land my first remote global job. You can do it too, but never aim for open-source as a road to Remote Jobs; if you want to make an impact in society free...
AWS Cloud Project build using native services.


Creating and Starting a Container
docker run -d --name my_container nginx- Use this command to create and start a container named my_container using the nginx image.Starting, Stopping, and Restarting Containers
docker stop my_container - Stops the specified container.
docker start my_container - Starts a previously stopped container.
docker restart my_container - Restarts a container.
Listing Containers
docker ps - Lists all currently running containers.
docker ps -a - Lists all containers, including those that are stopped.
Fetching an Image from a Registry
docker pull ubuntu- Retrieves the ubuntu image from the Docker Hub or other specified registry.Building an Image from a Dockerfile
docker build -t my_image .- Builds an image named my_image from a Dockerfile in the current directory.Listing and Removing Images
docker images - Lists all local Docker images.
docker rmi my_image - Removes the specified image from the local system.
Interacting with Containers
docker exec -it my_container bash - Executes a command (bash in this case) inside a running container.
docker attach my_container - Attaches to a running container for interaction.
docker logs my_container - Displays logs from the specified container.
Managing Container Resources
docker cp file.txt my_container:/path/to/destination - Copies files between a container and the host system.
docker pause my_container and docker unpause my_container - Pauses or unpauses a running container.
docker inspect my_container - Displays detailed information about a specific container.
Network Management
docker network ls - Lists all networks available on the Docker host.
docker network create my_network - Creates a new network.
docker network connect my_network my_container and docker network disconnect my_network my_container - Connects or disconnects a container from a network.
Volume Commands
docker volume ls - Lists all Docker volumes.
docker volume create my_volume - Creates a new volume named my_volume.
docker volume rm my_volume - Removes the specified volume.
docker volume inspect my_volume - Provides detailed information about a specific volume.
Follow Rohit Ghumare for more such an amazing content.
Check DevOpscommunity.in for more FREE resources.