首页 > 解决方案 > docker run -v : [Errno 2] 没有这样的文件或目录

问题描述

我正在尝试运行

docker run --rm -v ~/.aws:/root/.aws \
      -v $(pwd)/scripts:/root/scripts \
      --link "${DYNAMO_CONTAINER}:localhost" \
      amazon/aws-cli dynamodb batch-write-item \
          --request-items file:///root/scripts/sampledata.json \
          --endpoint-url http://localhost:8000

我得到的错误是

Error parsing parameter '--request-items': Unable to load paramfile file:///root/scripts/sampledata.json: [Errno 2] No such file or directory: '/root/scripts/sampledata.json'

我也试过

docker run --rm -v ~/.aws:/root/.aws \
      -v $(pwd)/scripts:/root \
      --link "${DYNAMO_CONTAINER}:localhost" \
      amazon/aws-cli dynamodb batch-write-item \
          --request-items file:///root/scripts/sampledata.json \
          --endpoint-url http://localhost:8000

docker run --rm -v ~/.aws:/root/.aws \
      -v $(pwd)/scripts:/root \
      --link "${DYNAMO_CONTAINER}:localhost" \
      amazon/aws-cli dynamodb batch-write-item \
          --request-items file:///root/sampledata.json \
          --endpoint-url http://localhost:8000

No such file...在最后一个上,尽管路径不同,但我仍然遇到错误。

主机scripts目录的结构是

scripts
├── sampledata.json
└── other.sh

我究竟做错了什么... ?

标签: dockerdocker-volume

解决方案


推荐阅读