I'm trying to setup an Elasticsearch cluster on Docker following this guide: https://sematext.com/blog/2016/12/12/docker-elasticsearch-swarm/
But I'm consistently getting an error about /tmp/docker.sock after creating the jwilder/nginx-proxy service. The below console snip is from a freshly installed and updated CentOS7. I installed docker via yum following the instructions here: 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]#
The jwilder/nginx-proxy container works when launched as a single container using the -v option to mount docker.sock.
I've scoured google (the Docker docs, the jwilder/nginx-proxy git) looking for what would cause this and I've come up with nothing. Does anyone see something wrong? I'm new to docker, so maybe I'm missing something easy.
Thanks in advance! :-)
Instead of making a read-only mount of /var/run/docker.sock
to /tmp/docker.sock
, you are making a mount of /var/run/docker.sock
to /tmp/docker.sock:ro
, hence the application cries.
To rectify this, make a slight modification. Replace...
--mount type=bind,bind-propagation=rshared,src=/var/run/docker.sock,target=/tmp/docker.sock:ro
...with:
--mount type=bind,bind-propagation=rshared,src=/var/run/docker.sock,target=/tmp/docker.sock,ro=1
From the documentation :
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.