1

ローカル マシンで sam を開始しました。以下はディレクトリ構造です。

 - application (python3 code)
 - efs (got some files)
 - template-local.yaml

さて、ボリュームアタッチでAPIを開始するようにsam localに指示するにはどうすればよいですか。

以下のコマンドを実行しています

sam local start-api \
  --template template-local.yaml \
  --docker-volume-basedir "/localmachine/project-folder/efs:/mnt/efs" \
  --profile otherAccount

コンテナーは正常に実行されますが、リクエスト localhost:3000 をヒットすると、以下のエラーでクラッシュします

...
File "/usr/local/Cellar/aws-sam-cli/0.45.0/libexec/lib/python3.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("invalid volume specification: '/localmachine/project-folder/efs/application:/var/task:ro,delegated'")
2020-06-22 20:52:04 127.0.0.1 - - [22/Jun/2020 20:52:04] "GET /status HTTP/1.1" 502 -

AWS SAM cli doc https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-start-api.html は、ボリュームのマウントに関する詳細を提供しません

私が間違っていることはありますか?

4

1 に答える 1

1

残念ながら、SAM に外部ボリュームをマウントする方法はありません。このレポを使用して、サムが内部にあるドッカーを構築し、マウンドと外部ボリュームを試みています

于 2020-10-18T09:46:47.713 に答える