2

I have win 10 and wsl2. I have docker-compose like this:

nginx:
image: nginx:latest
container_name: nginx
ports:
  - 80:80
volumes:
  - ./nginx/conf:/etc/nginx/conf.d
  - ./nginx/www:/var/www
  - ./nginx/logs:/var/log/nginx
domainname:
  dock.test
links:
  - php
  - db
networks:
  my:
    aliases:
      - dock.test

In case when docker daemon is on windows side (Docker Desktop) site opens by URL dock.test. But if i stop Docker desktop and start docker in wsl like sudo service docker start site is not available by domain dock.test (chrome error 'connection refused', not nginx error), but available by localhost (2 domains configured in nginx). It seems to me like docker in wsl doesnt know anything about dock.test. Can anyone help me? Thanks

Ilya
  • 21
  • 4

1 Answers1

0

I dont know how it works but when i put this lines in windows hosts file it works fine

127.0.0.1 dock.test
::1 dock.test
Ilya
  • 21
  • 4
  • Hi Ilya, which Linux under WSL2 did you run your docker? Do you have your steps documented somewhere or did you following any tutorial material to get things working? and if it was Alpine, would you take a look at https://stackoverflow.com/questions/72400077/docker-in-wsl2-alpine-without-docker-desktop pls? thx. – xpt May 27 '22 at 03:24