100% found this document useful (1 vote)
130 views1 page

Docker Cheat Sheet: by Via

This document provides a cheat sheet of common Docker commands organized into categories such as basic commands, container commands, image commands, volume commands, and network commands. It lists commands for building, running, stopping, and removing containers as well as for listing, pulling, and pushing images. It also includes options keywords that can be added to customize commands and explains how to connect containers to networks and copy files between containers and hosts.

Uploaded by

Fatima Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
130 views1 page

Docker Cheat Sheet: by Via

This document provides a cheat sheet of common Docker commands organized into categories such as basic commands, container commands, image commands, volume commands, and network commands. It lists commands for building, running, stopping, and removing containers as well as for listing, pulling, and pushing images. It also includes options keywords that can be added to customize commands and explains how to connect containers to networks and copy files between containers and hosts.

Uploaded by

Fatima Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Docker Cheat Sheet

by gambit via cheatography.com/69560/cs/17584/

Basic Docker Commands Misc. Commands

docker ps List of live containers docker cp <Co​nta​ine​r>:​<so​urc​e_p​ath> Copy from

docker ps -a List all containers <de​st_​pat​h> container to host

docker cp <source_path> <Container>:<dest_path> Copy from host to


docker info Retrieves docker config​uration
container
docker version Retrieves docker versioning
docker exec -ti <Co​nta​ine​r> <En​try​poi​nt> Executes the
docker build -t <Im​age​>: Builds a docker Image from Dockerfile or
terminal of a live
<​Tag> . container
container
docker push Pushes the image to the repo
<Im​age​_Na​me>​:<T​ag> Options Keywords
docker pull<I​mag​e_N​ame​>: Pulls the image from the repo
-p, –-publish Host to container port mapping
<​Tag>
--publ​ish-all Publish all ports

Container Commands --expose Expose container port

-d, –-detach Run in background


docker inspect <Container> Inspect a container

docker stats <Co​nta​ine​r> Live data stream from container -e, –-env set env vars

docker logs <Co​​nt​a​i​ne​​r> Retrieves the containers logs -v, --volume Mount files or direct​ories

docker run <Co​nta​ine​r> Run container -i, --inte​ractive

-t, --tty
docker kill <Co​nta​ine​r> Kill a running container
exec Run a new command in a container
docker start <Co​nta​ine​r> Start container
cp copy path
docker stop <Co​nta​ine​r> Stop a running container

docker restart <Co​nta​ine​r> Restarts the container These options keywords can be add to most docker commands

docker rm <Co​nta​ine​r> Remove container


Image Commands
docker port <Co​nta​ine​r> Lists the port mapping of the container
docker images List images
docker pause <Co​nta​ine​r> Suspends all the processes in the
container docker run <Im​age> runs the image

docker unpause <Container> Un-sus​pends all the processes in the docker create <Im​age​>:<​Tag> Create image
container docker rmi <Im​age> Remove image

<Co​nta​ine​r> can be replaced with the containers ID or NAME docker save <Im​age> Saves images to a tar archive

Volume Commands Network Commands

docker volume ls List volumes docker network ls List networks

docker volume inspect <Vo​lum​e> Inspect volume docker network inspect <Ne​two​rk> Inspect a network

docker volume create <Vo​lum​e> Create volume docker network create <Ne​two​rk> Create a network

docker volume rm <Vo​lum​e> Removes a volume docker network rm <Ne​two​rk> Removes a network

<Vo​lum​e> can be replaced with the volume ID or NAME docker network connect <Ne​two​rk> Connect a container to the
<Co​nta​ine​r> network

docker network connect --ip <IP> Specify the ip address of


<Ne​two​rk> <Co​nta​ine​r> container interface

docker network disconnect Disconnect container from


<Ne​two​rk_​Nam​e> <Co​nta​ine​r> network

<Ne​two​rk> can be replaced with the network ID or NAME

By gambit Published 26th October, 2018. Sponsored by CrosswordCheats.com


cheatography.com/gambit/ Last updated 25th October, 2018. Learn to solve cryptic crosswords!
Page 1 of 1. http://crosswordcheats.com

You might also like