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

38 lines
856 B
Markdown
Raw Normal View History

# docker
2016-01-19 14:48:21 -08:00
> Manage Docker containers and images.
> Some subcommands such as `run` have their own usage documentation.
> More information: <https://docs.docker.com/reference/cli/docker/>.
- List all Docker containers (running and stopped):
`docker ps --all`
- Start a container from an image, with a custom name:
2018-12-13 04:47:48 -05:00
`docker run --name {{container_name}} {{image}}`
- Start or stop an existing container:
2018-12-13 04:47:48 -05:00
`docker {{start|stop}} {{container_name}}`
2015-12-28 23:25:31 -05:00
- Pull an image from a Docker registry:
2018-11-14 02:12:03 +08:00
`docker pull {{image}}`
- Display the list of already downloaded images:
`docker images`
- Open an [i]nteractive [t]ty with Bourne shell (`sh`) inside a running container:
2015-12-28 23:25:31 -05:00
2018-12-13 04:47:48 -05:00
`docker exec -it {{container_name}} {{sh}}`
2017-03-16 00:37:17 -04:00
- Remove a stopped container:
2017-03-16 00:37:17 -04:00
2018-12-13 04:47:48 -05:00
`docker rm {{container_name}}`
- Fetch and follow the logs of a container:
2018-12-13 04:47:48 -05:00
`docker logs -f {{container_name}}`