devCodeCamp - Basic Docker Container 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
|
|
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
|
|
-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
|
|
--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
|
|
docker exec -it <container> <entrypoint>
|
Executes the command or terminal of a running container
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.