Renaming a container to the same name it already has, removes its name from the output of docker ps, and subsequent renames seem to fail;
docker run -dit --name oldname busybox
docker rename oldname oldname
docker rename oldname newname
Error response from daemon: No such container: oldname
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
28769c9aad42 busybox "sh" About a minute ago Up About a minute
Docker also no longer seems to detect that name when creating a new container, but libnetwork does;
docker run -dit --name oldname busybox 22a03f4411a06123f16a7ebd9f957a1091f842806bf0340b2439e05a586a0c1f
docker: Error response from daemon: service endpoint with name oldname already exists.
However, docker inspect still shows it has a name;
docker inspect --format "{{.Name}}" 28769c9aad42
/oldname
And, so has the newly created container:
docker inspect --format "{{.Name}}" 22a03f4411a0
/oldname
Renaming a container to the same name it already has, removes its name from the output of
docker ps, and subsequent renames seem to fail;Docker also no longer seems to detect that name when creating a new container, but libnetwork does;
However,
docker inspectstill shows it has a name;And, so has the newly created container: