Docker 版本 1.13.1,Docker Swarm,jwilder/nginx-proxy 不会作为 docker 服务启动
Docker version 1.13.1, Docker Swarm, jwilder/nginx-proxy will not start as a docker service
我正尝试按照本指南在 Docker 上设置 Elasticsearch 集群:https://sematext.com/blog/2016/12/12/docker-elasticsearch-swarm/
但我在创建 jwilder/nginx-proxy 服务后一直收到关于 /tmp/docker.sock 的错误。下面的控制台截图来自全新安装和更新的 CentOS7。我按照此处的说明通过 yum 安装了 docker:https://docs.docker.com/engine/installation/linux/centos/
[root@centos7]# docker -v
Docker version 1.13.1, build 092cba3
[root@centos7]#
[root@centos7]# docker service create --mode global \
> --name proxy -p 80:80 \
> --network elasticsearch-frontend \
> --network elasticsearch-backend \
> --mount type=bind,bind-propagation=rshared,src=/var/run/docker.sock,target=/tmp/docker.sock:ro \
> jwilder/nginx-proxy
xbhj4rzjyuu0k8maf1ha5fmgs
[root@centos7]# docker service ls
ID NAME MODE REPLICAS IMAGE
xbhj4rzjyuu0 proxy global 0/1 jwilder/nginx-proxy:latest
[root@centos7]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7ba303e0f8b6 jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 2 seconds ago Created proxy.kifcc5gbdcxz5ixsbx7sl1cv8.zuizhtt7q94nluuudlgjgy1yi
2fe655a93aa4 jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 10 seconds ago Exited (1) 3 seconds ago proxy.kifcc5gbdcxz5ixsbx7sl1cv8.baqn1204spbw5v6qxx6qjx327
7894fd0e1dee jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 18 seconds ago Exited (1) 11 seconds ago proxy.kifcc5gbdcxz5ixsbx7sl1cv8.6s9u0q0y1kjelebszheius2es
51840cca0d32 jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 26 seconds ago Exited (1) 19 seconds ago proxy.kifcc5gbdcxz5ixsbx7sl1cv8.wlwy723ts9kw00sgyu3s5f985
d52fd18567a9 jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 34 seconds ago Exited (1) 27 seconds ago proxy.kifcc5gbdcxz5ixsbx7sl1cv8.wa5jk9xnly1tdxpbvonnjmoty
[root@centos7]# docker logs 2fe655a93aa4
ERROR: you need to share your Docker host socket with a volume at /tmp/docker.sock
Typically you should run your jwilder/nginx-proxy with: `-v /var/run/docker.sock:/tmp/docker.sock:ro`
See the documentation at http://git.io/vZaGJ
[root@centos7]#
jwilder/nginx-proxy 容器在作为单个容器启动时使用 -v 选项挂载 docker.sock。
我已经搜索了 google(Docker 文档,jwilder/nginx-proxy git)寻找导致此问题的原因,但我一无所获。有人看到不对劲吗?我是 docker 的新手,所以我可能漏掉了一些简单的东西。
提前致谢! :-)
不是将 /var/run/docker.sock
挂载到 /tmp/docker.sock
,而是将 /var/run/docker.sock
挂载到 /tmp/docker.sock:ro
,因此应用程序会哭泣.
要纠正此问题,请稍作修改。替换...
--mount type=bind,bind-propagation=rshared,src=/var/run/docker.sock,target=/tmp/docker.sock:ro
...与:
--mount type=bind,bind-propagation=rshared,src=/var/run/docker.sock,target=/tmp/docker.sock,ro=1
readonly or ro: The Engine mounts binds and volumes read-write unless
readonly option is given when mounting the bind or volume. When true
or 1 or no value the bind or volume is mounted read-only. When false
or 0 the bind or volume is mounted read-write.
我正尝试按照本指南在 Docker 上设置 Elasticsearch 集群:https://sematext.com/blog/2016/12/12/docker-elasticsearch-swarm/
但我在创建 jwilder/nginx-proxy 服务后一直收到关于 /tmp/docker.sock 的错误。下面的控制台截图来自全新安装和更新的 CentOS7。我按照此处的说明通过 yum 安装了 docker:https://docs.docker.com/engine/installation/linux/centos/
[root@centos7]# docker -v
Docker version 1.13.1, build 092cba3
[root@centos7]#
[root@centos7]# docker service create --mode global \
> --name proxy -p 80:80 \
> --network elasticsearch-frontend \
> --network elasticsearch-backend \
> --mount type=bind,bind-propagation=rshared,src=/var/run/docker.sock,target=/tmp/docker.sock:ro \
> jwilder/nginx-proxy
xbhj4rzjyuu0k8maf1ha5fmgs
[root@centos7]# docker service ls
ID NAME MODE REPLICAS IMAGE
xbhj4rzjyuu0 proxy global 0/1 jwilder/nginx-proxy:latest
[root@centos7]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7ba303e0f8b6 jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 2 seconds ago Created proxy.kifcc5gbdcxz5ixsbx7sl1cv8.zuizhtt7q94nluuudlgjgy1yi
2fe655a93aa4 jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 10 seconds ago Exited (1) 3 seconds ago proxy.kifcc5gbdcxz5ixsbx7sl1cv8.baqn1204spbw5v6qxx6qjx327
7894fd0e1dee jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 18 seconds ago Exited (1) 11 seconds ago proxy.kifcc5gbdcxz5ixsbx7sl1cv8.6s9u0q0y1kjelebszheius2es
51840cca0d32 jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 26 seconds ago Exited (1) 19 seconds ago proxy.kifcc5gbdcxz5ixsbx7sl1cv8.wlwy723ts9kw00sgyu3s5f985
d52fd18567a9 jwilder/nginx-proxy@sha256:9a2d63aad9068f817c705965f41f2f32fa0bbef6b217ae5c9b2340ef23e3dcba "/app/docker-entry..." 34 seconds ago Exited (1) 27 seconds ago proxy.kifcc5gbdcxz5ixsbx7sl1cv8.wa5jk9xnly1tdxpbvonnjmoty
[root@centos7]# docker logs 2fe655a93aa4
ERROR: you need to share your Docker host socket with a volume at /tmp/docker.sock
Typically you should run your jwilder/nginx-proxy with: `-v /var/run/docker.sock:/tmp/docker.sock:ro`
See the documentation at http://git.io/vZaGJ
[root@centos7]#
jwilder/nginx-proxy 容器在作为单个容器启动时使用 -v 选项挂载 docker.sock。
我已经搜索了 google(Docker 文档,jwilder/nginx-proxy git)寻找导致此问题的原因,但我一无所获。有人看到不对劲吗?我是 docker 的新手,所以我可能漏掉了一些简单的东西。
提前致谢! :-)
不是将 /var/run/docker.sock
挂载到 /tmp/docker.sock
,而是将 /var/run/docker.sock
挂载到 /tmp/docker.sock:ro
,因此应用程序会哭泣.
要纠正此问题,请稍作修改。替换...
--mount type=bind,bind-propagation=rshared,src=/var/run/docker.sock,target=/tmp/docker.sock:ro
...与:
--mount type=bind,bind-propagation=rshared,src=/var/run/docker.sock,target=/tmp/docker.sock,ro=1
readonly or ro: The Engine mounts binds and volumes read-write unless readonly option is given when mounting the bind or volume. When true or 1 or no value the bind or volume is mounted read-only. When false or 0 the bind or volume is mounted read-write.