1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/docker.md
Waldir Pimenta a6fe2179ef docker: combine start/stop, add basic run example (#2363)
The start and stop examples are pretty much identical, so it doesn't make sense to use up the space of two examples in the limited length of a tldr page (especially for such a complex command as docker).

In the slot left by combining the two entries, a new one is added mentioning how to launch a container from an image. Placing this example before the start/stop commands (and naming the parameter "container_name" consistently trhoughout the page) also makes the sequence more logical, by first explaining how containers are instantiated, and only then mentioning how they are managed.
2018-10-01 21:50:57 +05:30

35 lines
792 B
Markdown

# docker
> Manage Docker containers and images.
- List currently running docker containers:
`docker container ls`
- List all docker containers (running and stopped):
`docker container ls -a`
- Start a container from an image, with a custom name:
`docker container run --name={{container_name}} {{image}}`
- Start or stop an existing container:
`docker container {{start|stop}} {{container_name}}`
- Start a container from an image and get a shell inside of it:
`docker container run -it {{image}} bash`
- Run a command inside of an already running container:
`docker container exec {{container_name}} {{command}}`
- Remove a stopped container:
`docker container rm {{container_name}}`
- Fetch and follow the logs of a container:
`docker container logs -f {{container_name}}`