I am trying to run docker-compose ps and docker-compose logs and neither are showing any output.
> sudo docker-compose -f /opt/docker-compose/server1-compose.yml ps
Name Command State Ports
------------------------------
> sudo docker-compose -f /opt/docker-compose/server1-compose.yml logs
Attaching to
Both commands are returning intended output. What is wrong here?
docker-compose version: 1.4.2
Docker version 1.7.1, build 786b29d
@crhuber, Is there any container running? What is the output of docker ps
?
@feliperuhland yes i see all the containers running as expected from the compose file. So i verified they are running but compose ps shows no output
I suspect what's happening here is that the project name is different. The default project name is the basename of a directory, so if you run docker-compose
from a different directory you might get a different project name.
You can set it with either -p
or COMPOSE_PROJECT_NAME
environment variable. If you look at the first part of the container names (before the first underscore) that's the project name.
There are open issues to configure the project name from a file. I think we'll be looking to implement that soon.
@dnephin you were exactly right sir. thank you for figuring it out. Adding the -p switch to my compose command fixed the issue.
ie: sudo docker-compose -f /opt/docker-compose/server1-compose.yml logs -p projectname
I faced the same issue as @crhuber docker-compose version 1.7.1, build 0a9ab35.
Steps to reproduce:
1 I am on folder with docker-compose.yml
2 Run docker-compose -p projname up -d
3 docker-compose ps shows nothing
4 But docker ps shows all running services
Athough if i run docker-compose up -d new service containers take name of folder and docker-compose ps works !
@yuklia
You can try this:
docker-compose -p projname ps
docker-compose version 1.7.1, build 0a9ab35
Most helpful comment
I suspect what's happening here is that the project name is different. The default project name is the basename of a directory, so if you run
docker-compose
from a different directory you might get a different project name.You can set it with either
-p
orCOMPOSE_PROJECT_NAME
environment variable. If you look at the first part of the container names (before the first underscore) that's the project name.There are open issues to configure the project name from a file. I think we'll be looking to implement that soon.