2015-12-27 18:11:20 +00:00
|
|
|
# docker
|
|
|
|
|
2016-01-19 22:48:21 +00:00
|
|
|
> Manage Docker containers and images.
|
2015-12-27 18:11:20 +00:00
|
|
|
|
2017-04-27 23:55:32 +01:00
|
|
|
- List currently running docker containers:
|
2015-12-27 18:11:20 +00:00
|
|
|
|
2017-09-28 10:25:00 +01:00
|
|
|
`docker container ls`
|
2015-12-27 18:11:20 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- List all docker containers (running and stopped):
|
2015-12-27 18:11:20 +00:00
|
|
|
|
2017-09-28 10:25:00 +01:00
|
|
|
`docker container ls -a`
|
2015-12-27 18:11:20 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Start a container:
|
2015-12-27 18:11:20 +00:00
|
|
|
|
2017-09-28 10:25:00 +01:00
|
|
|
`docker container start {{container}}`
|
2015-12-27 18:11:20 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Stop a container:
|
2015-12-27 18:11:20 +00:00
|
|
|
|
2017-09-28 10:25:00 +01:00
|
|
|
`docker container stop {{container}}`
|
2015-12-29 04:25:31 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Start a container from an image and get a shell inside of it:
|
2015-12-29 04:25:31 +00:00
|
|
|
|
2017-09-28 10:25:00 +01:00
|
|
|
`docker container run -it {{image}} bash`
|
2015-12-29 04:25:31 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Run a command inside of an already running container:
|
2015-12-29 04:25:31 +00:00
|
|
|
|
2017-09-28 10:25:00 +01:00
|
|
|
`docker container exec {{container}} {{command}}`
|
2017-03-16 04:37:17 +00:00
|
|
|
|
2017-09-28 10:25:00 +01:00
|
|
|
- Remove a stopped container:
|
2017-03-16 04:37:17 +00:00
|
|
|
|
2017-09-28 10:25:00 +01:00
|
|
|
`docker container rm {{container}}`
|