如何在Docker Compose期间运行`aws s3 sync`?

huangapple go评论100阅读模式
英文:

How run `aws s3 sync` during docker compose?

问题

以下是aws s3同步命令的代码片段:

  1. version: '3.8'
  2. services:
  3. amazon-aws-cli-download-test-data:
  4. image: amazon/aws-cli:2.13.0 # <- 今天的最新版本
  5. command:
  6. - s3 sync s3://mybucket/myfolder/ /s3/mybucket/myfolder/ --delete
  7. environment:
  8. - AWS_ACCESS_KEY_ID
  9. - AWS_SECRET_ACCESS_KEY
  10. - AWS_REGION
  11. volumes:
  12. - './test-data/s3:/s3'

错误信息:

  1. aws: error: argument command: Invalid choice, valid choices are:

s3命令是AWS CLI中最古老且肯定存在于所有AWS CLI版本中的命令。出了什么问题?如何在容器启动期间执行一些S3同步操作?

英文:

Here is snippet for aws s3 sync command:

  1. version: &#39;3.8&#39;
  2. services:
  3. amazon-aws-cli-download-test-data:
  4. image: amazon/aws-cli:2.13.0 # &lt;- newest version for today
  5. command:
  6. # | `aws` main command was also tried and error was the same
  7. # \/
  8. # - aws s3 sync s3://mybucket/myfolder/ /s3/mybucket/myfolder/ --delete
  9. - s3 sync s3://mybucket/myfolder/ /s3/mybucket/myfolder/ --delete
  10. environment:
  11. - AWS_ACCESS_KEY_ID
  12. - AWS_SECRET_ACCESS_KEY
  13. - AWS_REGION
  14. volumes:
  15. - &#39;./test-data/s3:/s3&#39;

The error:

  1. aws: error: argument command: Invalid choice, valid choices are:

The s3 command is the oldest that definitely present in all aws cli's. What is wrong? How execute some s3 syncing during containmer start up?

答案1

得分: 0

更改为:

  1. 命令:s3同步 s3://mybucket/myfolder/ /s3/mybucket/myfolder/ --delete

问题已修复。

英文:

Changes to

  1. command: s3 sync s3://mybucket/myfolder/ /s3/mybucket/myfolder/ --delete

fixed the issue

huangapple
  • 本文由 发表于 2023年7月10日 23:45:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76655349.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定