Cheatography
https://cheatography.com
devCodeCamp - Basic Docker Container Commands
Basic Docker commands
docker --help |
Displays basic help options and commands |
docker <command> --help |
Display detailed help for a specific command |
docker ps |
List of live containers |
docker ps -a |
List of all containers |
docker version |
Display docker versioning |
Container commands
docker run <image> |
Builds a new container using the image |
docker run [options] <image:tag@digest> <command> <arguments> |
Full syntax of docker run command |
docker create <image>:<tag> |
Creates a container using the image |
docker start <container> |
Starts a container |
docker stop <container> |
Stops a running container in an orderly manner |
docker kill <container> |
Immediately stops a running container |
docker restart <container> |
Restarts a container |
docker rm <container> |
Removes a container |
<container> can be replaced with the containers unique ID or unique NAME
Option Keywords
-i, --interactive |
Keep STDIN open even if not attached |
-t, --tty |
Allocate a psuedo-TTY |
-it |
Combines the -i and the -t options (interactive response) |
-a |
attach |
exec |
Run a new command in a container |
arguments
--name=<name> |
Assigns a name to a container: docker run --name=<name> <image> |
-a, --all |
Adds the option of all to container list: docker ps -a |
sh |
Entrypoint command for a shell in a container: docker run -it <image> sh or docker exec -it <container> sh |
Miscellaneous Commands
docker exec -it <container> <entrypoint> |
Executes the command or terminal of a running container |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by CashM