You are on page 1of 1

Docker Cheat Sheet

Container Management General Management Image Management

docker ps List the running containers. docker login Log in to a Docker registry. docker build Create an image from a
[dockerfile-path] Dockerfile.

docker ps -a List all the containers, both docker logout Log out of a Docker docker build . Build an image using the
running and stopped. registry. files from the current path.

docker create [image] Create a container without docker inspect [object] Show low-level information docker build -t [name]: Create an image from a
starting it. about an object. [tag] [location] Dockerfile and tag it.

docker create -it Create an interactive docker version Show the version of the docker build -f [file] Specify a file to build from.
[image] container with pseudo-TTY. local Docker installation.

docker rename Rename a container. docker info Display information about docker pull [image] Pull an image from a
[container] [new-name] the system. registry.

docker rm [container] Remove a stopped container. docker system prune Remove unused images, docker push [image] Push an image to a registry.
containers, and networks.

docker rm -f [container] Force remove a container, docker import [url/file] Create an image from a
even if it is running. tarball.

docker logs [container] View logs for a running


Running a Container docker commit Create an image from a
container. [container] [new-image] container.

docker logs -f --until= Retreive logs before a docker run [image] Run a command in a docker tag [image] Tag an image.
[interval] [container] specific point in time. [command] container based on an image. [image]:[tag]

docker events View real time events for a docker run --name Create, start, and name a docker images Show all locally stored top
[container] container. [container-name] [image] container. level images.

docker update Update the configuration docker run -p [host]: Map a host port to a docker history [image] Show history for an image.
[container] of a container. [container-port] [image] container port.

docker port [container] Show port mapping for a docker run --rm [image] Run a container and remove docker rmi [image] Remove an image.
container. it after it stops.

docker top [container] Show running processes docker run -d [image] Run a detached docker load --image Load an image from a tar
in a container. (background) container. [tar-file] archive file.

docker stats [container] Show live resource usage docker run -it [image] Run an interactive process, docker save [image] > Save an image to a tar
statistics for a container. e.g., a shell, in a container. [tar-file] archive file.

docker diff [container] Show changes to files or docker start [container] Start a container. docker search [query] Search Docker Hub for
directories on the filesystem. images.

docker cp [file-path] Copy a local file to docker stop [container] Stop a container. docker image prune Remove unused images.
CONTAINER:[path] a directory in a container.

docker restart Stop a container and start


[container] it again.

Networking docker pause [container] Pause processes in a Plugin Management


running container.

docker network ls View available networks. docker unpause Unpause processes in a docker plugin enable Enable a Docker plugin.
[container] running container. [plugin]

docker network rm Remove a network. docker wait [container] Block input until the docker plugin disable Disable a Docker plugin.
[network] container stops. [plugin]

docker network inspect Show information about a docker kill [container] Send a SIGKILL signal to docker plugin create Create a plugin from
[network] network. stop a container. [plugin] [path-to-data] config.json and rootfs.

docker network connect Connect a container to a docker attach Attach local standard input, docker plugin inspect View details about a
[network] [container] network. [container] output and error. [plugin] plugin.

docker network disconnect Disconnect a container docker exec -it Run a shell inside a running docker plugin rm Remove a plugin.
[network] [container] from a network. [container] [shell] container. [plugin]

You might also like