When accessing a remote machine I’d like to know if a container was started over docker run
or docker-compose
or some other means.
Is that even possible?
EDIT: the main reason for this was to find out, where these containers are getting orchestrated, i.e. if the container goes down, will be started again? Where would that configuration be?
2
Answers
Unfortunately that’s impossible. You can only guess it according to some secondary properties doing
docker inspect container-name
.For investigation purposes I created the most simplest docker-compose.yml:
Then run it with
docker-compose up
And lastly the normal way:
docker run -it --name cli hello-world
So I had two stopped containers:
Then I compared inspect output of both:
I found out that there are labels which compose creates:
Also compose uses another network:
You should do it on your environment and try to find out differences where you can surely differentiate between both launch ways.