gpt4 book ai didi

docker - 无效的装载路径 : 'db' mount path must be absolute

转载 作者:行者123 更新时间:2023-12-04 15:04:34 24 4
gpt4 key购买 nike

以下是我的 docker 文件:

FROM amazon/dynamodb-local
WORKDIR /home/dynamodblocal
RUN mkdir ./db && chown -R 1000 ./db
CMD ["-jar", "DynamoDBLocal.jar", "-dbPath", "./db", "-sharedDb"]
VOLUME ["./db"]

以下是 docker compose 文件:

version: "3.3" 
services:
dynamodb:
build:
context: .
dockerfile: dynamodb/Dockerfile
container_name: email_dynamo
ports:
- "8000:8000"
volumes:
- dynamodb-local:/home/dynamodblocal/db
seed:
image: amazon/aws-cli
container_name: email_dynamo_seed
links:
- dynamodb
depends_on:
- dynamodb
command: sh -c "~/seed/seed.sh"
entrypoint: []
volumes:
- ~/.aws:/root/.aws
- ./seed:/root/seed
volumes:
dynamodb-local:
driver: local

当我尝试运行 docker-compose up 时,出现以下错误:

Building with native build. Learn about native build in Compose here:https://docs.docker.com/go/compose-native-build/ Recreating89162581ebc2_email_dynamo ... error

ERROR: for 89162581ebc2_email_dynamo Cannot create container forservice dynamodb: invalid volume specification:'6cf8eb4d8edc2203adc35064b97ce90adc306c1e136a77a2e5e6203647564cd5:db:rw':invalid mount config for type "volume": invalid mount path: 'db' mountpath must be absolute

ERROR: for dynamodb Cannot create container for service dynamodb:invalid volume specification:'6cf8eb4d8edc2203adc35064b97ce90adc306c1e136a77a2e5e6203647564cd5:db:rw':invalid mount config for type "volume": invalid mount path: 'db' mountpath must be absolute ERROR: Encountered errors while bringing up theproject.

最佳答案

VOLUME 选项中的路径必须是容器中存在的路径。在您的情况下,需要将 VOLUME ["./db"] 更改为:VOLUME ["/home/dynamodblocal/db"]

WORKDIR 仅为 RUNCMDENTRYPOINTCOPY 设置默认目录ADD 命令。 不适用于 VOLUME!

关于docker - 无效的装载路径 : 'db' mount path must be absolute,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66399817/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com