Compose: --remove-orphans flag to clean it up

Created on 20 May 2016  路  6Comments  路  Source: docker/compose

docker-compose -f $yml up -d

WARNING: Found orphan containers (xxx_12345_aaaa_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating xxx_12345_aaaa_1

kinquestion

Most helpful comment

As the message points out, it seems you have renamed one of the services inside your docker-compose.yml file, and the container for said service still exists. If that is the case, you can decide to remove it using the --remove-orphans option.
Alternatively, it is possible this service belongs to another project with the same name, and is mistakenly detected by compose as a result - in which case, you can safely ignore this message.

All 6 comments

Can you clarify what seems to be the issue here?

Why there is a warning ?

As the message points out, it seems you have renamed one of the services inside your docker-compose.yml file, and the container for said service still exists. If that is the case, you can decide to remove it using the --remove-orphans option.
Alternatively, it is possible this service belongs to another project with the same name, and is mistakenly detected by compose as a result - in which case, you can safely ignore this message.

What do precisely define the "project name" ? The name of the folder where the docker-compose.yml lies ?

@yucer You can specified proj-name from command line, like this:
docker-compose -p xxx up
But is there anyway to specified project name from yml file? Because my directory name is BigCamel, the docker-compose can't use that name. So I want to specified it in file.

I did solve my problem with a different project name. In my case I do generate my projects from a template directory and I have set the project name in the folders name.

Now I've seen that the doc says:

https://docs.docker.com/v1.9/compose/reference/docker-compose/

Each configuration has a project name. If you supply a -p flag, you can specify a project name. If you don鈥檛 specify the flag, Compose uses the current directory name. See also the COMPOSE_PROJECT_NAME environment variable

Thanks!

Was this page helpful?
0 / 5 - 0 ratings