Tech / Dev

Docker Container Name Generator

Generate memorable names like 'happy-otter' or 'calm-river'. Compatible with Docker naming rules.

Instant🔒In your browserNo signup
Live

Docker name rules

Docker allows the characters [a-zA-Z0-9_.-] in container names, with a 64 character limit. The first character can't be -. If you don't specify a name, Docker generates a random one (hence the happy_curie-style names you see unintentionally).

"Adjective-noun" style

The <adjective>-<noun> pattern is memorable: it's easier to say "happy-otter" on a call than a hex hash. Good enough for dev and staging environments with few containers. For large clusters, add a numeric suffix to avoid collisions.

Production naming

In real clusters, the pattern is <service>-<env>-<index>: api-prod-1, api-prod-2, worker-staging-3. Allows scripting, listing by service (docker ps --filter name=api-prod) and aggregated metrics in Prometheus.

Container vs image

Distinction: the image name is my-org/my-app:1.2.3; the container name is the running instance. The same image can have hundreds of containers running, each with a unique name.

Naming in docker-compose

Compose names by default <project>_<service>_<index>. You can override with container_name: in the YAML, but you lose scalability (can't run two instances of the same service). Usually better to keep the default and use service to refer to the pool.

Naming in Kubernetes

In K8s, the "container name" lives inside the Pod and must follow DNS-1123: lowercase, digits and hyphens, max 63 characters, must start and end with alphanumeric. The Pod name is auto-generated: <deployment>-<hash>-<hash>.

Anti-patterns

  • Names with spaces or special characters: break scripts.
  • Host-specific names (my-laptop-app): not portable.
  • Names with sensitive data: end up in logs and metrics.
  • Reusing a name after docker rm: the old ID may live in monitoring metadata.

Cleanup

Containers with random names pile up on dev machines. docker container prune removes all stopped ones. docker system prune -a adds dangling images and volumes. Run it periodically on dev machines.

FAQ

Docker rules?

a-z, 0-9, _, ., -. Max 64 chars. No leading hyphen.

Why adj+animal?

Memorable, easy to say.

In prod?

service-env-index (api-prod-1).

Was this generator useful?