Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of renaming the docker container

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

What is the method of renaming the docker container? When you create a docker container, each container is automatically assigned a universal unique identifier (UUID) number to avoid naming conflicts. We can also name the container ourselves.

If no name is specified, by default, the Docker daemon assigns a UUID long identifier to the container, which generates a random string as the name.

Name the Docker container

When using the-name flag, you can assign unforgettable names to the docker container when you run them. The-d flag tells docker to run the container in detached mode in the background and print the new container ID.

$sudo docker run-d-name discourse_app local_discourse/app

To view a list of all docker containers, run the following command.

$sudo docker ps

From now on, every command that uses container_id can now be used with the name you specify.

$sudo docker restart discourse_app$ sudo docker stop discourse_app$ sudo docker start discourse_app

If you want to rename the docker container, use the name subcommand.

Container cloud products are implemented by deploying container services on cluster servers through docker technology. They are powerful and easy to use, and can be used as cluster services. Private networks can be built freely and service clusters can be built easily.

Tags: Container name service command cluster allocation run flag identity identifier method powerful free product functional powerful background character string situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Xiaomi Apple Docker