Docker Community Forums

Share and learn in the Docker community.

FR: Duplicate a container

I know we can commit an image out of running docker container and use that docker image to run a new docker container.

But, my use-case is.

I want to duplicate a running without passing those same argument again and again. Of course, if there should be option to add arguments for running new container on different port or set a new name.

Something like this:

docker [dup|duplicate] <container_id|container_name>

How would that even make sense? People stick container names, map host ports and volumes to containers, some are even commiting a crime and assign fixed ips to their containers. Dupplicating such containes would be more harm then good.

If you use docker-compose, you already would have all “argument” configured in your docker-compose.yml and could use the “–project” to run different instances of the whole stack.

If you are running everyting with manualy typed docker run commands then it’s time to step up your game and either put your commands in bash scripts or even better use docker-compose.yml’s to declare your containers.

They commit a crime and Metin has to pay for it. :laughing:

1 Like

You can create a new image from that container using the docker commit command:

docker commit c5a24953e383 newimagename
And then start a new container from that image:

docker run […same arguments as the other one…] newimagename