Docker Cheat Sheet
by gambit via cheatography.com/69560/cs/17584/
Basic Docker Commands                                                            Misc. Commands
docker ps                         List of live containers                        docker cp <Container>:<source_path>                    Copy from
docker ps -a                      List all containers                            <dest_path>                                                container to host
                                                                                 docker cp <source_path> <Container>:<dest_path>               Copy from host to
docker info                       Retrieves docker configuration
                                                                                                                                               container
docker version                    Retrieves docker versioning
                                                                                 docker exec -ti <Container> <Entrypoint>                Executes the
docker build -t <Image>:        Builds a docker Image from Dockerfile or
                                                                                                                                               terminal of a live
<Tag> .                          container
                                                                                                                                               container
docker push                       Pushes the image to the repo
<Image_Name>:<Tag>                                                          Options Keywords
docker pull<Image_Name>:      Pulls the image from the repo
                                                                                 -p, –-publish           Host to container port mapping
<Tag>
                                                                                 --publish-all          Publish all ports
Container Commands                                                               --expose                Expose container port
                                                                                 -d, –-detach            Run in background
docker inspect <Container>       Inspect a container
docker stats <Container>      Live data stream from container                 -e, –-env               set env vars
docker logs <Container>   Retrieves the containers logs                   -v, --volume            Mount files or directories
docker run <Container>        Run container                                   -i, --interactive
                                                                                 -t, --tty
docker kill <Container>       Kill a running container
                                                                                 exec                    Run a new command in a container
docker start <Container>      Start container
                                                                                 cp                      copy path
docker stop <Container>       Stop a running container
docker restart <Container>    Restarts the container                          These options keywords can be add to most docker commands
docker rm <Container>         Remove container
                                                                                 Image Commands
docker port <Container>       Lists the port mapping of the container
                                                                                 docker images                                List images
docker pause <Container>      Suspends all the processes in the
                                 container                                       docker run <Image>                          runs the image
docker unpause <Container>       Un-suspends all the processes in the           docker create <Image>:<Tag>               Create image
                                 container                                       docker rmi <Image>                          Remove image
<Container> can be replaced with the containers ID or NAME                    docker save <Image>                         Saves images to a tar archive
Volume Commands                                                                  Network Commands
docker volume ls                                   List volumes                  docker network ls                                List networks
docker volume inspect <Volume>                   Inspect volume                docker network inspect <Network>               Inspect a network
docker volume create <Volume>                    Create volume                 docker network create <Network>                Create a network
docker volume rm <Volume>                        Removes a volume              docker network rm <Network>                    Removes a network
<Volume> can be replaced with the volume ID or NAME                            docker network connect <Network>               Connect a container to the
                                                                                 <Container>                                   network
                                                                                 docker network connect --ip <IP>                 Specify the ip address of
                                                                                 <Network> <Container>                       container interface
                                                                                 docker network disconnect                        Disconnect container from
                                                                                 <Network_Name> <Container>                network
                                                                                 <Network> 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