docker container is not accessible from other machines on host’s network

I was doing some devops and writing a script to turn my current host/nginx server/nginx setup into a host/docker/nginx server/docker/nginx set up so I can keep directories and etc the same between them.

The problem is that any ports I expose on a docker container are only accessible on the host and not from any other machines on the host network.

When typing 192.168.0.2 from a machine such as 192.168.0.3 it just says took too long to respond, but typing 192.168.0.2 from 192.168.0.2 will bring up the welcome to nginx page?! The interesting part is I did a wireshark analysis on en0 on port 80 and there are actually some ports coming through

See pastebins of packet inspections:
LAN to docker: https://pastebin.com/4qR2d1GV
Host to docker: https://pastebin.com/Wbng9nDB

I’ve tried using docker run -p 192.168.0.2:80:80 nginx/nginx and docker run -p 127.0.0.1:80:80 nginx/nginx but this doesn’t seem to fix anything.

Should see welcome to nginx when connecting from 192.168.0.3 to 192.168.0.2.

this is in my dev environment which is an osx 10.13.5 system.

when I push this to my ubuntu 16.04 server it works just fine with the containerized nginx accessible from the www

Source: StackOverflow