I have a docker composition with 3 contaiers. I would like to keep these 3 containers and recreate another instance of the composition, without reusing, nor deleteing the previous 3 containers. Conceptually, would be like running 2 intances of the same application, where the application is the composition.
Docker compose always tries to reuse the existing containers.
Asked
Active
Viewed 30 times
0

Emil Salageanu
- 997
- 1
- 10
- 24
1 Answers
3
You can specify a different project for your compose file.
docker-compose -p namespace2 up -d
By default, the project name is the name of the directory where your docker-compose is. You could also create a new dir and copy your compose file into it. It's the same as specifying -p
. It basically specifies the namespace for the objects in your compose file.

Bernard
- 16,149
- 12
- 63
- 66
-
Thanks, that was what I was looking for. – Emil Salageanu Sep 06 '16 at 13:28
-
You can also pass a project name using the `$COMPOSE_PROJECT_NAME` environment variable – dnephin Sep 06 '16 at 14:14