In the previous article, we introduced how to rename the docker image name.
This article will show you how to rename the docker container.
List docker images
➜ ~ docker images
![](https://www.linuxcommands.site/wp-content/uploads/2020/02/image-21-1024x125.png)
Running docker image u-lnmp
➜ ~ docker run -i -t ccc6e87d482b /bin/bash
root@642d75c62761:/# exit
exit
List docker containers
➜ ~ docker ps -a
The container name just started is randomly generated and has no meaning.
Rename the name of container: 642d75c62761 to u-lnmp-c
➜ ~ docker rename 642d75c62761 u-lnmp-c
Of course, we can also specify the container name when running a new container by executing the docker run command, so as to avoid subsequent modification of the container name.
➜ ~ docker run --name u-lnmp-cc -i -t ccc6e87d482b /bin/bash