Show Menu
Cheatography

devCodeCamp Docker Container Cmds Cheat Sheet by

devCodeCamp - Basic Docker Container Commands

Basic Docker commands

docker --help
Displays basic help options and commands
docker <co­mma­nd> --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 <im­age>
Builds a new container using the image
docker run [options] <im­age­:ta­g@d­ige­st> <co­mma­nd> <ar­gum­ent­s>
Full syntax of docker run command
docker create <im­age­>:<­tag>
Creates a container using the image
docker start <co­nta­ine­r>
Starts a container
docker stop <co­nta­ine­r>
Stops a running container in an orderly manner
docker kill <co­nta­ine­r>
Immedi­ately stops a running container
docker restart <co­nta­ine­r>
Restarts a container
docker rm <co­nta­ine­r>
Removes a container
<co­nta­ine­r> can be replaced with the containers unique ID or unique NAME

Option Keywords

-i, --inte­ractive
Keep STDIN open even if not attached
-t, --tty
Allocate a psuedo-TTY
-it
Combines the -i and the -t options (inter­active response)
-a
attach
exec
Run a new command in a container

arguments

--name­=<n­ame>
Assigns a name to a container: docker run --name­=<n­ame> <im­age>
-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 <im­age> sh or docker exec -it <co­nta­ine­r> sh

Miscel­laneous Commands

docker exec -it <co­nta­ine­r> <en­try­poi­nt>
Executes the command or terminal of a running container
       
 

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

          More Cheat Sheets by CashM

          Firebase-Express Template with User Auth Cheat Sheet
          React & Material UI Project startup Cheat Sheet
          devCodeCamp Docker Commands (Inclusive) Cheat Sheet