LinuxCommandLibrary

docker-rename

Rename an existing Docker container

TLDR

View documentation for the original command

$ tldr docker container rename
copy

SYNOPSIS

docker rename [OPTIONS] CONTAINER NEW_NAME

PARAMETERS

CONTAINER
    Current container name or ID

NEW_NAME
    New unique container name

DESCRIPTION

The docker rename command changes the name of a Docker container identified by its current name or ID to a new unique name. This operation is lightweight, atomic, and does not interrupt the container's execution, whether running or stopped. It preserves all container data, configuration, volumes, and state.

Containers are core to Docker's workflow, and naming them meaningfully aids management, scripting, and orchestration. Use this command to fix typos, reorganize projects, or align with naming conventions in tools like Docker Compose or Kubernetes.

Permissions require ownership or Docker daemon access. The target name must be unique across all containers on the host. Failure occurs if the source doesn't exist or the target is taken. No options are container-specific; standard Docker CLI flags apply globally.

CAVEATS

New name must be unique; source container must exist. Single container only per invocation. No support for bulk renames.

EXAMPLES

docker rename old-app new-app
docker rename sha256:abc123 mycontainer

EXIT CODES

0: success
1: generic error (e.g., name conflict)

HISTORY

Introduced in Docker 1.0 (2014) as part of core CLI for container lifecycle management. Evolved with Docker Engine; stable since inception with minor usability tweaks in later releases.

SEE ALSO

docker(1), docker-create(1), docker-ps(1), docker-rm(1)

Copied to clipboard