我想用马拉松部署一个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 '
我将/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": {}
}
]
}
如何通过马拉松授权拉动图像?
答案 0 :(得分:0)
您应该阅读:https://mesosphere.github.io/marathon/docs/native-docker-private-registry.html
按照步骤1,在步骤2中用{/ 1>替换uris
部分
"fetch" : [
{
"uri" : "https://path.to/file",
"extract" : true,
"outputFile" : "dockerConfig.tar.gz"
}
]
我在这里写了更详细的解释:http://blog.itaysk.com/2017/05/22/using-a-custom-private-docker-registry-with-marathon