docker:name_a_container
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
docker:name_a_container [2017/02/22 16:22] – created peter | docker:name_a_container [2020/05/13 08:41] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Docker - Name a container ====== | ||
- | |||
- | By adding **--name=meaningful_name** to the **docker run** command, an evil_ptolomy becomes more recognizable in interactive sessions as well as in the output of commands like docker ps. There are limitations, | ||
- | |||
- | On the Command Line or in a Dockerfile: | ||
- | |||
- | <code bash> | ||
- | docker run --name=meaningful_name | ||
- | </ | ||
- | |||
- | For example, if we ran a container based on the nginx base image and started it like this: | ||
- | |||
- | <code bash> | ||
- | docker run --name nginx -d nginx | ||
- | </ | ||
- | |||
- | The name would appear in the list of running containers: | ||
- | |||
- | <code bash> | ||
- | docker ps | ||
- | </ | ||
- | |||
- | Output: | ||
- | |||
- | < | ||
- | CONTAINER ID IMAGE | ||
- | 08f333ef7216 | ||
- | </ | ||
- | |||
- | While the name appears in the output of docker ps and can be used to manage the container, it will not appear in the command prompt of the container if you attach to it or in log files. | ||
docker/name_a_container.1487780571.txt.gz · Last modified: 2020/07/15 09:30 (external edit)