Skip to main content

Command Palette

Search for a command to run...

Docker Command Reference Table

Updated
2 min readView as Markdown
S

I’m currently learning Linux, AWS, DevOps, MySQL, and related technologies, aiming to become a Cloud Engineer. Passionate about cloud infrastructure and automation, I’m excited to apply these skills in real-world projects.

Command / OptionDescription
docker run <image>Run a container from an image
docker run -d <image>Run container in detached mode (in background)
docker run -it <image>Run container interactively with terminal
docker run --name <name> <image>Give container a custom name
docker run -v <host_path>:<container_path>Bind mount a volume (host dir ↔ container dir)
docker run -p <host_port>:<container_port>Map host port to container port
docker run -m <memory_limit>Set memory limit for the container (e.g. -m 512m)
docker run --cpu-shares <value>Set container CPU priority (relative weight)
docker run --storage-opt size=<size>Set container storage size limit (overlay2 driver)
docker run --env <key>=<value>Pass an environment variable
docker run --env-file <file>Load environment variables from a file
docker psList running containers
docker ps -aList all containers (running + stopped)
docker stop <container>Stop a running container
docker start <container>Start a stopped container
docker restart <container>Restart a container
docker kill <container>Force stop a container immediately
docker rm <container>Remove a stopped container
docker rm -f <container>Force remove a running container
docker imagesList all images
docker rmi <image>Remove an image
docker pull <image>Download image from Docker Hub
docker push <repo>Push image to Docker Hub
docker loginLogin to Docker Hub
docker logoutLogout from Docker Hub
docker tag <image> <repo>:<tag>Tag image for pushing to repo
docker save -o <file>.tar <image>Save image to tar archive
docker load -i <file>.tarLoad image from tar archive
docker exec -it <container> <cmd>Run a command inside a running container (e.g. bash)
docker inspect <container or image>Show detailed info (JSON format)
docker logs <container>View logs from a container
docker cp <container>:<path> <local>Copy files from container to host
docker cp <local> <container>:<path>Copy files from host to container
docker network lsList Docker networks
docker volume lsList Docker volumes
docker system dfShow Docker disk usage summary
docker system pruneClean up unused containers/images/networks/volumes

#

More from this blog

Shreyash_myakal

35 posts

Currently learning AWS DevOps & Cloud to expand my tech expertise, blending business acumen with technical growth.