Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy and rename a Docker container?

Tags:

docker

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?

like image 622
DigiLord Avatar asked Sep 26 '13 18:09

DigiLord


People also ask

How do I change the name of a docker container?

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!

How do I copy a docker container?

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.


1 Answers

The docker rename command is part of Docker 1.5. Link to commit: docker github

like image 97
SergiiKozlov Avatar answered Sep 28 '22 00:09

SergiiKozlov