tldr/pages/common/docker.md

36 lines
689 B
Markdown
Raw Normal View History

# docker
2016-01-19 22:48:21 +00:00
> 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:
`docker container start {{container}}`
- Stop a container:
`docker container stop {{container}}`
2015-12-29 04:25:31 +00:00
- Start a container from an image and get a shell inside of it:
2015-12-29 04:25:31 +00:00
`docker container run -it {{image}} bash`
2015-12-29 04:25:31 +00:00
- Run a command inside of an already running container:
2015-12-29 04:25:31 +00:00
`docker container exec {{container}} {{command}}`
2017-03-16 04:37:17 +00:00
- Remove a stopped container:
2017-03-16 04:37:17 +00:00
`docker container rm {{container}}`
- Fetch and follow the logs of a container:
`docker container logs -f {{container}}`