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
Managor 1ff3c74910
docker: improve example, docker-image: add a pointer towards docker-rmi (#15709)
Co-authored-by: Wiktor Perskawiec <git@spageektti.cc>
2025-02-08 15:01:33 +01:00

37 lines
866 B
Markdown

# docker
> 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:
`docker run --name {{container_name}} {{image}}`
- Start or stop an existing container:
`docker {{start|stop}} {{container_name}}`
- Pull an image from a Docker registry:
`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:
`docker exec -it {{container_name}} {{sh}}`
- Remove stopped containers:
`docker rm {{container1 container2 ...}}`
- Fetch and follow the logs of a container:
`docker logs -f {{container_name}}`