I have a docker container that I want to use to partition client access to a database. I'd like to be able to have one container per client. If I start multiple copies of the container they all have the same name, the only difference being the port the container is assigned to.
How can I copy/rename the containers in such a way that I can differentiate the container without having to consult a lookup table that matches the assigned port to the client?
To rename a 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. After renaming a containers, confirm that it is now using the new name. For more information, see the docker-run man page. That's all!
Obtain the name or id of the Docker container. Issue the docker cp command and reference the container name or id. The first parameter of the docker copy command is the path to the file inside the container. The second parameter of the docker copy command is the location to save the file on the host.
The docker rename
command is part of Docker 1.5. Link to commit: docker github
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With