1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 10:42:07 +02:00

docker: simplify examples (#2597)

This commit is contained in:
Matthew Peveler 2018-12-13 04:47:48 -05:00 committed by Starbeamrainbowlabs
parent 3448b135ec
commit 1fe90c65d6

View file

@ -4,36 +4,32 @@
- List currently running docker containers: - List currently running docker containers:
`docker container ls` `docker ps`
- List all docker containers (running and stopped): - List all docker containers (running and stopped):
`docker container ls -a` `docker ps -a`
- Start a container from an image, with a custom name: - Start a container from an image, with a custom name:
`docker container run --name={{container_name}} {{image}}` `docker run --name {{container_name}} {{image}}`
- Start or stop an existing container: - Start or stop an existing container:
`docker container {{start|stop}} {{container_name}}` `docker {{start|stop}} {{container_name}}`
- Pull an image from a docker registry: - Pull an image from a docker registry:
`docker pull {{image}}` `docker pull {{image}}`
- Start a container from an image and get a shell inside of it: - Open a shell inside of an already running container:
`docker container run -it {{image}} bash` `docker exec -it {{container_name}} {{sh}}`
- Run a command inside of an already running container:
`docker container exec {{container_name}} {{command}}`
- Remove a stopped container: - Remove a stopped container:
`docker container rm {{container_name}}` `docker rm {{container_name}}`
- Fetch and follow the logs of a container: - Fetch and follow the logs of a container:
`docker container logs -f {{container_name}}` `docker logs -f {{container_name}}`