Docker inside wsl2 and Docker desktop differences

Viewed 456

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

1 Answers

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
Related