无效的挂载路径:“[”挂载路径必须是绝对的

时间:2021-04-28 21:41:17

标签: docker docker-compose

我有一个看起来像这样的 Dockerfile

FROM clkao/postgres-plv8:12-2
VOLUME [ "/cfg" ]
ADD wait-for-env.sh /usr/local/bin
ENTRYPOINT [ "wait-for-env.sh", "/cfg/commondb.env", "docker-entrypoint.sh" ]
CMD ["postgres"]

在我的 docker-compose 文件中,我有应用程序的定义

commondb:
restart: "no"
container_name: commondb
build: 
  context: ./postgres
  args: 
    - build_version
    - build_type
image: commonpostgres:$build_version
ports:
  - "5532:5432"
volumes: 
  - /Users/Projects/work/app/cfg:/cfg
networks:
  - common_network

项目布局如下

app/
    /cfg
    /postgres
        Dockerfile
    docker-compose.yml

当我尝试运行命令时

docker-compose up -d --no-deps --build commondb

我收到此错误

invalid mount config for type "volume": invalid mount path: '[' mount path must be absolute

有什么问题?

Docker 检查包含 VOLUME 的镜像

[
    {
        "Id": "sha256:75305aec38e534124a4463fd7d9b1db2729c9ab6f7a577bae03ba2bf1d3f60b4",
        "RepoTags": [
            "commonpostgres:3.5.0.0"
        ],
        "RepoDigests": [],
        "Parent": "sha256:0d6739604f9c967bc553d9ef86fab26bf04148ec808d017544a64ea11a4afce0",
        "Comment": "",
        "Created": "2021-04-28T21:31:59.495950295Z",
        "Container": "4b4a9fa0b7b568fab8cc8c08b4d1d808cf239bebdb4f7b4e99468807c7e5ee1b",
        "ContainerConfig": {
            "Hostname": "4b4a9fa0b7b5",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5432/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/12/bin",
                "GOSU_VERSION=1.11",
                "LANG=en_US.utf8",
                "PG_MAJOR=12",
                "PG_VERSION=12.0-2.pgdg100+1",
                "PGDATA=/var/lib/postgresql/data",
                "PLV8_VERSION=2.3.13",
                "PLV8_SHASUM=1a96c559d98ad757e7494bf7301f0e6b0dd2eec6066ad76ed36cc13fec4f2390"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "CMD [\"postgres\"]"
            ],
            "Image": "sha256:0d6739604f9c967bc553d9ef86fab26bf04148ec808d017544a64ea11a4afce0",
            "Volumes": {
                "/cfg": {},
                "/var/lib/postgresql/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "wait-for-env.sh",
                "/cfg/commondb.env",
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "DockerVersion": "20.10.0",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5432/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/12/bin",
                "GOSU_VERSION=1.11",
                "LANG=en_US.utf8",
                "PG_MAJOR=12",
                "PG_VERSION=12.0-2.pgdg100+1",
                "PGDATA=/var/lib/postgresql/data",
                "PLV8_VERSION=2.3.13",
                "PLV8_SHASUM=1a96c559d98ad757e7494bf7301f0e6b0dd2eec6066ad76ed36cc13fec4f2390"
            ],
            "Cmd": [
                "postgres"
            ],
            "Image": "sha256:0d6739604f9c967bc553d9ef86fab26bf04148ec808d017544a64ea11a4afce0",
            "Volumes": {
                "/cfg": {},
                "/var/lib/postgresql/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "wait-for-env.sh",
                "/cfg/commondb.env",
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 454477235,
        "VirtualSize": 454477235,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/c43f2711d56d01bf0fefefb817fb57b90b71dcc66a8caf14e5be023a3937412b/diff:/var/lib/docker/overlay2/30849bcdc6fa46adc8143fb024581eeba3f4782e934efa1699e286a08598eb36/diff:/var/lib/docker/overlay2/8bf9f40aff831f3fdafe0e1fb927cc48217b196dcea61cddb9333fc2aa9e2158/diff:/var/lib/docker/overlay2/5394092f6731a527286ebbcb937ebf4205f3a8d47e85858c666cb668b268ed2e/diff:/var/lib/docker/overlay2/d5b97a6dcb82b989d7bc148c3562deafc5a1fcc54f6914dba2c3d015d9bfb673/diff:/var/lib/docker/overlay2/b8b9c7d1df726a42880c7c3d79906ba99d05b5cc2c529fe8c926cd3a1c6de43f/diff:/var/lib/docker/overlay2/9ce8b97437eb97ca8496407dabd1e42f0e29777770341c6656f3f41967b03064/diff:/var/lib/docker/overlay2/0986240c02d95212640a3548ec0c779dd8848ebfcbb5fe6d76ee1ee21bf8b7bc/diff:/var/lib/docker/overlay2/b0401675a6ea74611dcaadd21277d0c345040cf90e4a602441693f5978a74af7/diff:/var/lib/docker/overlay2/1f7dc7b63d69e0f980d667d77235b8ae4d4480970b66adf1022d7d0b4c28e301/diff:/var/lib/docker/overlay2/40062a1fff7fe08f66a701c7f9e74bb6176b6ffba64c200bbd34161200be7805/diff:/var/lib/docker/overlay2/f3c26a8b6785a27acfff5d864b230b412f5f21fc0b97c9f6eb33721a7d20e289/diff:/var/lib/docker/overlay2/a6281953415b6ca1ceb9f45d081e894ef80b305e1886e5dcd2f65456ec76f8b0/diff:/var/lib/docker/overlay2/20d6863a2e45a495c87219c484e646d35be097a61e245b03f69254251b0c0eba/diff:/var/lib/docker/overlay2/b2f5affd0345af000c105d98bc09292c072d70112943b2fe39d018007a12ce24/diff",
                "MergedDir": "/var/lib/docker/overlay2/8fc58d4a6afb173f6bcc9817244884631e51be84b2ef877597de774f8c7cb2cb/merged",
                "UpperDir": "/var/lib/docker/overlay2/8fc58d4a6afb173f6bcc9817244884631e51be84b2ef877597de774f8c7cb2cb/diff",
                "WorkDir": "/var/lib/docker/overlay2/8fc58d4a6afb173f6bcc9817244884631e51be84b2ef877597de774f8c7cb2cb/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:b67d19e65ef653823ed62a5835399c610a40e8205c16f839c5cc567954fcf594",
                "sha256:3ba344018aaff62dd13803a69103c3d558772f57d473f0017fe71fc642c197ac",
                "sha256:809946863d5edc06613a9ca26ef18fa8ba643455414791fc3ce1dde763abcf6d",
                "sha256:ddb50a567803b21f5e965a754a7ac6044d168a4c69adef21fb798203357d776b",
                "sha256:64f23a63821fa976eeafdcdaefe6a134c3a30a2929f25faea3fce7d967c96f20",
                "sha256:22f5303efdd797b083171067b63dfb55016f9ebb382ea754c8f8b12de57a0e07",
                "sha256:9cf9bdafe72ee52884b1924b9a3d52efab48ea16a3ccebeabf4c842721084358",
                "sha256:662023ffbbc50f4d9d9944649d7c7a7a1cd144a0340a1811939f0aabbdb06650",
                "sha256:a6a5c9284280aa35ea39c4cd2e5034d8e90f68607bad3825ab7762fcd9e10c5f",
                "sha256:8f168552100645641000e1da3c19651f1de531160171280c3df5a3c9d36c5dd0",
                "sha256:038d255941805552d62e75ba9ee0bfadb6cfd9ba6382736c974de17960b82a44",
                "sha256:9b3cf71cdd1a0cf3a34a043cc57adc92e38b233ae2782426c3c17ebe773b9c90",
                "sha256:db69dddb79103c20dc4f1b603f9413411dc0ba8ead21abcc4a3d2ea2707a2692",
                "sha256:eb866fc784eaeac79c170d29d28986cced57b1b19d7601885eaf32b46cfbe860",
                "sha256:93c4e7a68f1d76d09e39d2cbd8e9ba566c5479175699a87d4cd85b813468f464",
                "sha256:7476cca7ed2915679c64704742543509b3650b0409ead1b2cf143c223d0936e9"
            ]
        },
        "Metadata": {
            "LastTagTime": "2021-04-28T22:11:51.141550664Z"
        }
    }
]

0 个答案:

没有答案