Docker cheat sheet Cheat Sheet
by rishabkumar7 via cheatography.com/132291/cs/38939/
General Commands Dockerfile Instructions (cont)
docker version Shows the Docker version information VOLUME Create a mount point with the specified name and
docker info Display system-wide information mark it as holding externally mounted volumes from
native host or other containers
docker help <command> Shows help for a specific command
USER Set the user name or UID to use when running the
Image Commands image and for any RUN, CMD and ENTRYPOINT
instructions that follow it in the Dockerfile
docker images List images
WORKDIR Sets the working directory for any RUN, CMD,
docker pull <image> Pull an image or a repository from a registry
ENTRYPOINT, COPY and ADD instructions that follow
docker rmi <image> Remove one or more images it in the Dockerfile
Container Commands Dockerfile Commands
docker ps Lists running containers docker build -t <tag> Build an image from a Dockerfile in the
docker ps -a List all containers (both running and current directory
stopped) docker tag <image> Tag an image to a name (local or registry)
docker run <image> Run a command in a new container <tag>
docker start Start one or more stopped containers
docker restart Restart one or more containers
docker stop <containe‐ Stop one or more running containers
r>
docker rm <container> Remove one or more containers
docker rename Rename a container
Dockerfile Instructions
FROM Set the Base Image for subsequent instructions
RUN Execute any commands in a new layer on top of
the current image and commit the results
CMD Provide defaults for an executing container
EXPOSE nform Docker that the container listens on the
specified network ports at runtime
ENV Set environment variables
ADD Copy new files, directories or remote file URLs
from <src> and add them to the filesystem of the
image at the path <dest>
COPY Copy new files or directories from <src> and add
them to the filesystem of the container at the path
<dest>
ENTRYPOINT Allows you to configure a container that will run as
an executable
By rishabkumar7 Published 25th May, 2023. Sponsored by CrosswordCheats.com
Last updated 25th May, 2023. Learn to solve cryptic crosswords!
Page 1 of 1. http://crosswordcheats.com
cheatography.com/rishabkumar7/