Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to modify the container name by docker

Shulou Source: shulou.com Published: 2022-06-01 03:07:38 10月04日 Update

This article shows you how to modify the container name of docker, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.

In the actual operation of docker, we will inevitably be dissatisfied with the name of the container that is already running. At this point, all you need is a container rename operation. The way to rename the docker container is the docker rename command.

1. Check the container list first

The docker ps command can see a list of all the containers that are running. If you do not see the container you want to change in the list, then it is possible that the relevant container is in a stopped state. At this point, carry out the order

Docker ps-a

two。 Perform a rename operation

The purpose of looking at the list is to see container id and name. Because the first parameter of docker rename can be id or name.

Docker rename

If the name of one container is the same as the id of another container. For example: they are all ab123. So, which container will be renamed when using docker rename for this ab123?

The first parameter of docker rename matches NAME first, and then ID. In other words, the statement will be executed correctly twice, first renaming name to ab123's container and second renaming id to ab123's container.

The above is how to change the container name of docker. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Container that is command run name content parameter skill time knowledge concise concise that is name actual article method more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology NVidia Shulou Tech Info Xiaomi Apple