I've reviewed several posts on this topic and can't yet find a resolution that works for me
https://forums.docker.com/t/how-can-i-navigate-to-container-website-from-host-browser/25035
How to access Docker container's web server from host
Can't connect to static website in Docker container from host.
I have followed this tutorial
https://tecadmin.net/tutorial/docker-run-static-website
the docker container from that effort runs and when I exec into it I can curl the website successfully
from the host I cannot connect to the website in the docker container
I can't post screen shots yet so...
-----------------------------------------
My host is windows 10
I am using Oracle VirtualBox
docker version returns
Version: 19.03.1
API version: 1.40
Go version: go1.12.7
Git commit: 74b1e89e8a
Built: Wed Jul 31 15:18:18 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:49:35 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
----------------------------------------
Dockerfile
-----------------------------------------
COPY . /usr/share/nginx/html
EXPOSE 127.0.0.1:8080
-----------------------------------------
Docker build command used
-----------------------------------------
docker build -t img-static-site-example .
-----------------------------------------
Docker run command used
-----------------------------------------
docker run -it -d -p 127.0.0.1:8080:80 img-static-site-example
-----------------------------------------
curl to check
------------------------------------------
none of the below work from the host
curl http://172.17.0.3
curl http://172.17.0.3:8080
curl http://localhost:8080
curl http://192.168.99.102
curl http://192.168.99.102:80
curl http://192.168.99.102:8080
curl http://192.168.99.102:2376
----------------------------------------
docker-machine ip returns 192.168.99.102
-----------------------------------------
"NetworkSettings": {
"Bridge": "",
"SandboxID": "43d2a1e8e8429e48b5dde91385d5933e2fa095d868b67f1d6ed59a1aca1e1665",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"80/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8080/tcp": null
},
"SandboxKey": "/var/run/docker/netns/43d2a1e8e842",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "530b098a8d01838fa4e408033a905a3f9f8b8c538a8cefa13a937b24ff325136",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:03",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "2436a76997d6a454900798af80bf6c35482397acd66a44a07e411d6617e56339",
"EndpointID": "530b098a8d01838fa4e408033a905a3f9f8b8c538a8cefa13a937b24ff325136",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:03",
"DriverOpts": null
}
}