virtualisation:docker:docker_basics
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| virtualisation:docker:docker_basics [2022/12/04 11:51] – created - external edit 127.0.0.1 | virtualisation:docker:docker_basics [2023/12/13 05:41] (current) – [Running a Container] srohr | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Basic Docker commands ====== | ||
| + | \\ | ||
| + | ===== Running a Container ===== | ||
| + | |||
| + | '' | ||
| + | \\ | ||
| + | |||
| + | ===== Downloading a Container Image ===== | ||
| + | |||
| + | ''// | ||
| + | |||
| + | < | ||
| + | root@hdcdev01: | ||
| + | latest: Pulling from library/ | ||
| + | Digest: sha256: | ||
| + | Status: Image is up to date for nginx: | ||
| + | docker.io/ | ||
| + | root@hdcdev01: | ||
| + | </ | ||
| + | \\ | ||
| + | ===== Creating a Container from an Image ===== | ||
| + | \\ | ||
| + | ===== Starting a Container ===== | ||
| + | |||
| + | ''// | ||
| + | \\ | ||
| + | ===== Listing Docker Containers ===== | ||
| + | |||
| + | ''// | ||
| + | < | ||
| + | root@hdcdev01: | ||
| + | CONTAINER ID | ||
| + | 4e7e0d9d7963 | ||
| + | dcc0e627c5b2 | ||
| + | </ | ||
| + | \\ | ||
| + | ''// | ||
| + | < | ||
| + | root@hdcdev01: | ||
| + | CONTAINER ID | ||
| + | 4e7e0d9d7963 | ||
| + | dcc0e627c5b2 | ||
| + | acf87a65ecda | ||
| + | 25ff71bdd9a3 | ||
| + | c2c01f546383 | ||
| + | b6dd05c80f90 | ||
| + | ef0ab877942f | ||
| + | </ | ||
| + | \\ | ||
| + | ===== Connecting to Docker Containers ===== | ||
| + | |||
| + | ''// | ||
| + | ''// | ||
| + | ''// | ||
| + | To exit the container, type ''// | ||
| + | < | ||
| + | root@hdcdev01: | ||
| + | root@dcc0e627c5b2:/# | ||
| + | exit | ||
| + | root@hdcdev01: | ||
| + | root@hdcdev01: | ||
| + | root@dcc0e627c5b2:/# | ||
| + | exit | ||
| + | root@hdcdev01: | ||
| + | </ | ||
| + | \\ | ||
| + | ===== Copy files from/to Docker Container ===== | ||
| + | |||
| + | Use the Docker '' | ||
| + | |||
| + | Copy a specific file //TO// the container: | ||
| + | docker cp foo.txt container_id:/ | ||
| + | |||
| + | Copy a specific file //FROM// the container: | ||
| + | docker cp container_id:/ | ||
| + | |||
| + | Copy multiple files from //source// to the //target// folder: | ||
| + | docker cp source/. container_id:/ | ||
| + | docker cp container_id:/ | ||
| + | | ||
| + | \\ | ||
| + | ===== Backup Docker Container ===== | ||
| + | |||
| + | < | ||
| + | root@hdcdev01: | ||
| + | CONTAINER ID | ||
| + | 33e92ed82b82 | ||
| + | root@hdcdev01: | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | root@hdcdev01: | ||
| + | sha256: | ||
| + | root@hdcdev01: | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | root@hdcdev01: | ||
| + | root@hdcdev01: | ||
| + | </ | ||
| + | [[https:// | ||
