Closed KiraResari closed 5 years ago
-p
needs to appear before the subcommand (e.g. up
) to be parsed correctly.
Ah, okay, that explains it. There was no working code sample on the documentation, so I just naively assumed that the -p
flag would need to go at the same place as the -d
flag.
I honestly don't understand why these two flags need to be separated to work, but this fixed my issue, so thank you very much for your swift and accurate help! =^,^=
Also, for the sake of future docker-compose users, I would like to have a working code sample included on the dockerfile CLI reference page to illustrate the proper use of this flag in the "Use -p to specify a project name" section. Is there any way I can help with that? Or don't I have the security clearance for that?
Description of the issue
According to the docker-compose CLI documentation, it should be possible to set the name of a docker-compose Project using the
-p
flag.However, whenever I try that, the only thing that happens is that the docker-compose on-screen reference is displayed, indicating that my command was not understood by the parser.
For example running
docker-compose up -d -p Test
for a docker-compos.yml File that normally works returns returns the following:Said docker-compose.yml file looks like this:
The background behind this is that we want to use Docker to deploy "clones" of our application with different settings to different ports on the same server (so we have for example a foobar-database_container_1443, a foobar-database_container_1453 and so on...) . Doing that without defining a project name to docker-compose results in the following warning:
I have also tried setting the project name as an environment variable in the relevant docker-compose.yml files like this:
...but that did not have any effect.
So, long story made short: The -p flag as written in the Documentation is not working for me, the alternative of setting the project name as an environment variable is not working either, and I thus have no idea how I am supposed to set the project name for docker-compose to get rid of the false detection of "orphan containers".
Context information (for bug reports)
Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
Steps to reproduce the issue
docker-compose up -d -p Test
Observed result
On-screen explanation of some of the functionalities of docker-compose is displayed on screen, which implies that the command was not understood, see above.
Expected result
The project should be built as defined in the docker-compose.yml and given the project name as defined in the -p flag
Stacktrace / full error message
Additional information
Using Docker for Windows to deploy Windows Containers.