我想用marathon部署一个docker容器,如果docker镜像没有授权,镜像可以正常拉取,但是当我尝试从需要授权的存储库中拉取镜像时,任务部署失败,响应为
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如下:
{
"id": "/web",
"cmd": "docker login --username='sam' --passwoer='123456' example.com/web:latest",
"cpus": 0.3,
"mem": 32,
"disk": 0,
"instances": 1,
"env": {
"EMAIL_USE_TLS": "False",
"DATABASE_URI": "mysql://user:123456@RDS:3306/test"
},
"container": {
"type": "DOCKER",
"volumes": [
{
"containerPath": "/data/supervisor/",
"hostPath": "/data/workspace/logs/supervisor/",
"mode": "RW"
}
],
"docker": {
"image": "daocloud.io/gizwits2015/gwaccounts:1.6.0",
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 0,
"hostPort": 0,
"servicePort": 10000,
"protocol": "tcp",
"labels": {}
}
],
"privileged": false,
"parameters": [
{
"key": "add-host",
"value": "RDS:10.66.125.161"
}
],
"forcePullImage": false
}
},
"portDefinitions": [
{
"port": 10000,
"protocol": "tcp",
"name": "default",
"labels": {}
}
]
}
我怎样才能拉马拉松授权的形象?
1条答案
按热度按时间ssm49v7z1#
您应该阅读:https://mesosphere.github.io/marathon/docs/native-docker-private-registry.html
按照步骤1,在步骤2中更换
uris
带的截面我在这里写了更详细的解释:http://blog.itaysk.com/2017/05/22/using-a-custom-private-docker-registry-with-marathon