Hi all,
Are there any plans for docker-compose inspect command?
One could get e.g. exposed ports of given service
Thanks
docker-compose ps
already lets you see exposed ports.
Hello friend, I made a module to solve this https://github.com/jsrun/docker-compose-remote-api
I agree! It would be very useful to have the commands available to docker itself also available to docker-compose.
Why was this closed?
It won't be implemented. For the rare cases where it would be useful, people can use docker inspect
instead.
docker inspect only works if you setup your --project_name correctly.
But then I am also happy with docker inspect.
I don't get it... why is then docker-compose exec
implemented? or docker-compose logs
?
+1
I would like to be able to write a script to check if a container is running but if the containers were started using compose and not named, then I don't know the name.
It would be great to be able to inspect docker-compose containers so one does not need to know the project name beforehand.
For what it's worth: You can do something like (assuming the service to check is named foo
)
docker inspect $(docker-compose ps -q foo)
Hope that helps.
Is there a way to get the docker-compose project name programmatically? docker inspect
isn't an option if a script can't determine the project name that compose generated.
For example, there is no consistent way to remove named volumes programmatically.
@deeky666
I tried your suggestion and it works well for docker-compose.yml service definitions where one did not use --project-name
. However, if that is what one did, it does not work as docker-compose ps -q _servicename_
returns nothing.
Is there anything one can do in the case described above?
Thank you
@larssb I'm not sure if I get you right but maybe this helps?
docker inspect $(docker-compose --project-name PROJECT_NAME ps -q SERVICE_NAME)
Hi @deeky666
Sure ... I might not have explained myself properly. If I for some reason, forgot, lost or for whatever reason, do not have the project name used. So I can't use the --project-name
parameter to docker-compose ps
... is there then a way by which I can determine the project name that was used.
Thank you.
Most helpful comment
For what it's worth: You can do something like (assuming the service to check is named
foo
)Hope that helps.