Cheatography
https://cheatography.com
Important Docker Commands
General Commands
docker version |
Shows the Docker version information |
docker info |
Display system-wide information |
docker help <command> |
Shows help for a specific command |
Image Commands
docker images |
List images |
docker pull <image> |
Pull an image or a repository from a registry |
docker rmi <image> |
Remove one or more images |
Container Commands
docker ps |
Lists running containers |
docker ps -a |
List all containers (both running and stopped) |
docker run <image> |
Run a command in a new container |
docker start |
Start one or more stopped containers |
docker restart |
Restart one or more containers |
docker stop <container> |
Stop one or more running containers |
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 |
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 instructions that follow it in the Dockerfile |
WORKDIR |
Sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile |
Dockerfile Commands
docker build -t <tag> |
Build an image from a Dockerfile in the current directory |
docker tag <image> <tag> |
Tag an image to a name (local or registry) |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by rishabkumar7