Show Menu
Cheatography

Docker cheat sheet Cheat Sheet by

Important Docker Commands

General Commands

docker version
Shows the Docker version inform­ation
docker info
Display system­-wide inform­ation
docker help <co­mma­nd>
Shows help for a specific command

Image Commands

docker images
List images
docker pull <im­age>
Pull an image or a repository from a registry
docker rmi <im­age>
Remove one or more images

Container Commands

docker ps
Lists running containers
docker ps -a
List all containers (both running and stopped)
docker run <im­age>
Run a command in a new container
docker start
Start one or more stopped containers
docker restart
Restart one or more containers
docker stop <co­nta­ine­r>
Stop one or more running containers
docker rm <co­nta­ine­r>
Remove one or more containers
docker rename
Rename a container
 

Dockerfile Instru­ctions

FROM
Set the Base Image for subsequent instru­ctions
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 enviro­nment variables
ADD
Copy new files, direct­ories or remote file URLs from <sr­c> and add them to the filesystem of the image at the path <de­st>
COPY
Copy new files or direct­ories from <sr­c> and add them to the filesystem of the container at the path <de­st>
ENTRYPOINT
Allows you to configure a container that will run as an executable
VOLUME
Create a mount point with the specified name and mark it as holding externally mounted volumes from native host or other containers
USER
Set the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instru­ctions that follow it in the Dockerfile
WORKDIR
Sets the working directory for any RUN, CMD, ENTRYP­OINT, COPY and ADD instru­ctions that follow it in the Dockerfile

Dockerfile Commands

docker build -t <ta­g>
Build an image from a Dockerfile in the current directory
docker tag <im­age> <ta­g>
Tag an image to a name (local or registry)
   
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Docker Cheat Sheet

          More Cheat Sheets by rishabkumar7

          Git CLI Cheat Sheet
          AWS CLI EC2 Cheat Sheet