Get docker-compose.yml file location from running container?

前端 未结 4 1892
一生所求
一生所求 2021-02-03 19:57

I have a few running docker containers created by executing docker-compose up.

Is there any way to get the exact file path of the corresponding docker-c

4条回答
  •  耶瑟儿~
    2021-02-03 20:05

    The answer to this question seems o have changed with new versions of docker-compose. There is a label "com.docker.compose.project.working_dir": "/var/opt/docker", that points to the directory where I started docker-compose. I have not checked if that is pwd or the actual location of the docker-compose.yml file.

    this got me interesting information about docker-compose:

    samuel@vmhost1:~$ docker inspect fc440a1afbaa | grep com.docker.compose
                    "com.docker.compose.config-hash": "89069285a4783b79b421ea84f2b652becbdee148fbad095a6d9d85aab67ececc",
                    "com.docker.compose.container-number": "1",
                    "com.docker.compose.oneoff": "False",
                    "com.docker.compose.project": "docker",
                    "com.docker.compose.project.config_files": "docker-compose.yml",
                    "com.docker.compose.project.working_dir": "/var/opt/docker",
                    "com.docker.compose.service": "jenkins",
                    "com.docker.compose.version": "1.25.0"
    samuel@vmhost1:~$ 
    

    I'm running docker-compose.yml configuration version 3.6

提交回复
热议问题