如何拉马拉松码头形象需要授权

mitkmikd  于 2021-06-26  发布在  Mesos
关注(0)|答案(1)|浏览(335)

我想用marathon部署一个docker容器,如果docker镜像没有授权,镜像可以正常拉取,但是当我尝试从需要授权的存储库中拉取镜像时,任务部署失败,响应为

  1. Failed to launch container: Failed to run 'docker -H unix:///var/run/docker.sock pull example.com/web:laest': exited with status 1; stderr='Error response from daemon: repository example.com/web not found: does not exist or no pull access '

我在node和master上将/var/run/docker.sock文件的权限改为777,但问题仍然出现,似乎权限不是问题的根本原因;我尝试在节点上运行“docker login”,手动拉取图片,然后马拉松任务正确运行,我的马拉松json如下:

  1. {
  2. "id": "/web",
  3. "cmd": "docker login --username='sam' --passwoer='123456' example.com/web:latest",
  4. "cpus": 0.3,
  5. "mem": 32,
  6. "disk": 0,
  7. "instances": 1,
  8. "env": {
  9. "EMAIL_USE_TLS": "False",
  10. "DATABASE_URI": "mysql://user:123456@RDS:3306/test"
  11. },
  12. "container": {
  13. "type": "DOCKER",
  14. "volumes": [
  15. {
  16. "containerPath": "/data/supervisor/",
  17. "hostPath": "/data/workspace/logs/supervisor/",
  18. "mode": "RW"
  19. }
  20. ],
  21. "docker": {
  22. "image": "daocloud.io/gizwits2015/gwaccounts:1.6.0",
  23. "network": "BRIDGE",
  24. "portMappings": [
  25. {
  26. "containerPort": 0,
  27. "hostPort": 0,
  28. "servicePort": 10000,
  29. "protocol": "tcp",
  30. "labels": {}
  31. }
  32. ],
  33. "privileged": false,
  34. "parameters": [
  35. {
  36. "key": "add-host",
  37. "value": "RDS:10.66.125.161"
  38. }
  39. ],
  40. "forcePullImage": false
  41. }
  42. },
  43. "portDefinitions": [
  44. {
  45. "port": 10000,
  46. "protocol": "tcp",
  47. "name": "default",
  48. "labels": {}
  49. }
  50. ]
  51. }

我怎样才能拉马拉松授权的形象?

ssm49v7z

ssm49v7z1#

您应该阅读:https://mesosphere.github.io/marathon/docs/native-docker-private-registry.html
按照步骤1,在步骤2中更换 uris 带的截面

  1. "fetch" : [
  2. {
  3. "uri" : "https://path.to/file",
  4. "extract" : true,
  5. "outputFile" : "dockerConfig.tar.gz"
  6. }
  7. ]

我在这里写了更详细的解释:http://blog.itaysk.com/2017/05/22/using-a-custom-private-docker-registry-with-marathon

相关问题