mbr
mbr

Reputation: 333

Docker nginx problem when using docker compose - share your Docker host socket with a volume at /tmp/docker.sock

when trying this docker-compose.yml I get the error: ERROR: you need to share your Docker host socket with a volume at /tmp/docker.sock I understand that the image is using docker socket volume mapping. If I am using the docker command like

docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy

it does work as expected.

using the docker compose file

version: '2'

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

  whoami:
    image: jwilder/whoami
    environment:
      - VIRTUAL_HOST=whoami.local

I was expecting the same behavior but I get for the nginx container => "ERROR: you need to share your Docker host socket with a volume at /tmp/docker.sock"

I am using Docker Desktop on Windows 10 (Version 1909)

❯ docker compose up nginx-proxy
[+] Running 1/0
 - Container jwildertest_nginx-proxy_1  Created                                                                           0.0s
Attaching to nginx-proxy_1
nginx-proxy_1  | ERROR: you need to share your Docker host socket with a volume at /tmp/docker.sock
nginx-proxy_1  | Typically you should run your nginxproxy/nginx-proxy with: `-v /var/run/docker.sock:/tmp/docker.sock:ro`
nginx-proxy_1  | See the documentation at http://git.io/vZaGJ
nginx-proxy_1 exited with code 1

Upvotes: 1

Views: 1403

Answers (1)

mbr
mbr

Reputation: 333

Looks like it was a problem with Docker Desktop. Since the latest Update to v20.10.7 Docker engine the problem is gone.

Upvotes: 0

Related Questions