docker-container-rename

rename an existing container

TLDR

Rename a container
$ docker container rename [old_name] [new_name]

SYNOPSIS

docker container rename container newname_

DESCRIPTION

docker container rename renames a container to a new name without affecting its configuration, state, or data. This operation works on both running and stopped containers, allowing you to correct naming mistakes or reorganize your container naming scheme.Container names must be unique on the Docker host. Renaming does not modify the container's ID or any other attributes beyond the name itself. The shorthand alias docker rename is equivalent.

INSTALL

sudo apt install docker-cli
sudo dnf install docker-cli
sudo pacman -S docker
sudo apk add docker-cli
sudo zypper install docker
brew install docker
nix profile install nixpkgs#docker

CAVEATS

Other containers that referenced the old name via Docker DNS or the legacy `--link` flag will continue to use the old name until reconnected or restarted. Compose-managed containers should be renamed through Compose configuration to keep state consistent.

SEE ALSO

docker-rename(1), docker-container(1)