How to rename Docker images without rebuilding it

96.5K    Asked by JacobRutherford in Devops , Asked on Jul 27, 2021

 I created one docker image, but I forgot to give some name, By default it has taken an anonymous name. Can someone tell me how can I rename docker image?

Answered by Liam SMITH

You can rename your docker image by docker tag command. Use the below given command to do that.

  $ docker tag OldName:tag NewName:tag

Or another way to rename docker container

To rename docker container, use the rename sub-command as shown, in the following example, we renaming the container discourse_app to a new name disc_app.

  $ sudo docker rename discourse_app disc_app

After renaming a containers, confirm that it is now using the new name.

  $ sudo docker ps


Your Answer

Interviews

Parent Categories