aws cli无法从dynamodb docker容器中读取

我正在Docker容器上运行dynamodb,并能够使用python boto3写入表格,这一切都很好。

现在当我使用aws CLI从容器外部查询dynamodb表时,它给出这个错误并且找不到表

╰─➤ aws dynamodb --region=eu-west-1 --endpoint-url http://localhost:8000 scan --table-name devApiConfig A client error (ResourceNotFoundException) occurred when calling the Scan operation: Cannot do operations on a non-existent table 

由dynamodb docker容器创build的sqlite数据库的名称是

 localaccesskey_eu-west-1.db aws --region=eu-west-1 dynamodb list-tables --endpoint-url http://localhost:8000 { "TableNames": [] } 

任何想法或提示,如从Boto3使用dynamodb上存在的表格….?

我已经回答了另一个问题: https : //stackoverflow.com/a/40806393/1061798

检查你的docker如何启动Dyanmo。 如果您使用的是deangiberson / aws-dynamodb-local(与我一样),那么您将需要更改启动参数以添加-sharedDb。 修改Dockerfile或者运行如下:

 docker run -p 8000:8000 -d -it deangiberson/aws-dynamodb-local "-sharedDb" 

我没有testing,所以让我知道如果这不起作用,但希望你明白了。