dockerdocker-composedockerfile

How to know which command or compose file has been used to start Docker containers?


Is there any way to find a source of the docker container script? I have a setup where I can not find any docker-compose.yml file nor the bash script etc that would have run all the Docker containers currently running. I have a virtual machine that starts docker containers on the startup, but have no idea which file is actually run.


Solution

  • If the containers are running automatically on reboot and you have no cron/bash profile/rc.local or any other startup screen then that may mean that they are containers with --restart option set. You can change that by running below command

    docker ps -q | xargs docker update --restart no
    docker ps -q | xargs docker stop
    

    Then restart the machine. The containers should not start. If they do then you have some script somewhere which is starting them