Verify the new container name
In the previous step, you renamed the Docker container from my-hello-container
to renamed-hello-container
. In this final step, you will perform a definitive check to ensure that the container now has the new name and that the old name is no longer associated with it.
We will use the docker ps -a
command again to list all containers and their details.
docker ps -a
Examine the output carefully. You should see the container listed with the name renamed-hello-container
. It is also important to confirm that there is no container listed with the old name, my-hello-container
.
To specifically verify the presence of the new name and the absence of the old name using command-line tools, you can use grep
.
First, check for the new name:
docker ps -a | grep renamed-hello-container
This command should return output if the container was successfully renamed.
Next, check for the old name. This command should not return any output if the renaming was successful.
docker ps -a | grep my-hello-container
By performing both checks, you can be confident that the container has been correctly renamed.