docker:run-stop-containers
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
docker:run-stop-containers [2024/02/19 23:20] – ↷ Page name changed from docker:run-stop-an-image to docker:run-stop-containers odefta | docker:run-stop-containers [2024/02/23 19:40] (current) – odefta | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Run a docker | + | ====== |
+ | |||
+ | < | ||
+ | docker ps | ||
+ | </ | ||
+ | Output: | ||
+ | < | ||
+ | e26c2dcdc6a0 | ||
+ | b8a3da1af510 | ||
+ | 32bdc9aabb3f | ||
+ | e319f3296383 | ||
+ | 42b90dc323ee | ||
+ | </ | ||
+ | |||
+ | ====== Display all docker containers ====== | ||
+ | |||
+ | < | ||
+ | docker ps -a | ||
+ | </ | ||
+ | |||
+ | ====== Connect to an existing running container to execute commands ====== | ||
+ | |||
+ | -it accepts container id or name | ||
+ | < | ||
+ | docker exec -it b1faf04f660b bash | ||
+ | </ | ||
+ | |||
+ | ====== Run a docker | ||
< | < | ||
Line 6: | Line 33: | ||
Hello World | Hello World | ||
- | ===== Run an image and connect to shell ===== | + | ===== Run a container |
To connect to the image shell and interact (i) with terminal (t), run: | To connect to the image shell and interact (i) with terminal (t), run: | ||
Line 25: | Line 52: | ||
If no registry is specified, the docker command will search in Docker Hub (https:// | If no registry is specified, the docker command will search in Docker Hub (https:// | ||
</ | </ | ||
- | |||
- | ===== Display running docker containers ===== | ||
- | |||
- | < | ||
- | docker ps | ||
- | </ | ||
- | Output: | ||
- | < | ||
- | e26c2dcdc6a0 | ||
- | b8a3da1af510 | ||
- | 32bdc9aabb3f | ||
- | e319f3296383 | ||
- | 42b90dc323ee | ||
- | </ | ||
- | |||
- | ===== Display all docker containers ===== | ||
- | |||
- | < | ||
- | docker ps -a | ||
- | </ | ||
====== Stop a running docker container ====== | ====== Stop a running docker container ====== |
docker/run-stop-containers.1708377604.txt.gz · Last modified: 2024/02/19 23:20 by odefta