docker1.12 swarm 自定义镜像的启动

首先,这个问题是认识上的错误导致的,记录在这里希望后来人能少走弯路

#这样启动一个自定义的镜像是没有问题的,因为有td两个参数

docker run -itd centos6/dubbo-cli /bin/bash

#而在swarm中就出现问题了,总是启动不了

docker service create --replicas 2 --name local_7 kongxx/centos-7 /bin/bash

#日志中确实有一个报错,为此绕了一个大弯儿!搭建了私有仓库,还弄了https。但还是不行

Jan 10 17:39:42 BETA-1-49 dockerd: time="2017-01-10T17:39:42.887662729+08:00" level=debug msg="Trying to pull kongxx/centos-7 from https://index.docker.io v1"
Jan 10 17:39:42 BETA-1-49 dockerd: time="2017-01-10T17:39:42.887699236+08:00" level=debug msg="hostDir: /etc/docker/certs.d/docker.io"
Jan 10 17:39:42 BETA-1-49 dockerd: time="2017-01-10T17:39:42.887910409+08:00" level=debug msg="[registry] Calling GET https://index.docker.io/v1/repositories/centos6/dubbo-cli/images"
Jan 10 17:39:42 BETA-1-49 dockerd: time="2017-01-10T17:39:42.888288873+08:00" level=debug msg="pull progress map[status:Pulling repository docker.io/centos6/dubbo-cli]"
Jan 10 17:39:43 BETA-1-49 dockerd: time="2017-01-10T17:39:43.924342733+08:00" level=error msg="Not continuing with pull after error: Error: image centos6/dubbo-cli:latest not found"
Jan 10 17:39:43 BETA-1-49 dockerd: time="2017-01-10T17:39:43.924412313+08:00" level=error msg="pulling image failed" error="Error: image kongxx/centos-7:latest not found" module=taskmanager task.id=8ebm1hq3n60pyvvbyulub2jyl

最后终于意识到了方向错误,将启动命令改为:

docker service create --replicas 2 --name local_7 kongxx/centos-7 sleep 1000

服务终于顺利启动起来了。

原因就是没有-td两个参数时,执行完/bin/bash就会直接推出了,而docker swarm 会不断的重启。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值