I have installed Docker for Windows and could start a webserver(nginx). I am using Docker Version: 18.06.1-ce-win73 (19507) and Windows Version: 10.0.16299 Enterprise.
For now i can access in the browser of the host OS (windows) under "http://localhost/" the webserver.
What i would like to do is following:
Start 2 webserver(webA[nginx] and webB[apache]) using docker and access them trough the host browser. I would like to have e.g. "http://webA" to access webA and "http://webB" to access webB.
I tried to give the container different IPs and used host-file but it did not work. Like i read under: https://docs.docker.com/docker-for-windows/networking/#i-cannot-ping-my-containers it is not possible to bind it is not possible to bind an IP to a container under windows.
Now i try to use docker in a VMWare where i start a linux but imho seems this approach a bit heavy.
How to achieve this?
You have to use two different ports for 2 services.
You run your nginx container like
docker run --name some-nginx -d -p 80:80 some-content-nginx
And then run apache like
docker run -dit --name my-apache -p 8080:80 my-apache2
The result is you get a nginx on http://localhost:80 and apache on http://localhost:8080.
If you want to have http://webA.yourdomain.com, you will have to either config vhost on your host, or use a proxy like traefik
.