docker:name_a_container
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
docker:name_a_container [2017/02/22 16:29] – peter | docker:name_a_container [2020/05/13 08:41] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Docker - Name a container ====== | ||
- | |||
- | By adding **< | ||
- | |||
- | 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.1487780963.txt.gz · Last modified: 2020/07/15 09:30 (external edit)