Automatically Generate Human-Readable Container Names

If you don’t define a name for a docker container an automatically generated name will be created.

Create Three Containers

Create and start (docker run) a detacted (--detach) container using the nginx:latest Docker image. Run this three times.

docker run --detach nginx:latest
docker run --detach nginx:latest
docker run --detach nginx:latest

View Automatically Generated Names

Show the Docker containers that are running (docker ps).

Add (-a) to view all containers.

docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS               NAMES
6a96b0488618        nginx:latest                "/docker-entrypoint.…"   4 seconds ago       Up 2 seconds        80/tcp              nifty_antonelli
495ee8ab187a        nginx:latest                "/docker-entrypoint.…"   6 seconds ago       Up 4 seconds        80/tcp              silly_ramanujan
6b29f78dbf01        nginx:latest                "/docker-entrypoint.…"   8 seconds ago       Up 7 seconds        80/tcp              dazzling_diffie

In this example, the three automatically generated human-readable names are nifty_antonelli, silly_ramanujan, and dazzling_diffie.