Using localhost for to access running container

Hello,

When you specify 127.0.0.1:3000:3000, you are binding to the docker host’s 127.0.0.1. Since your docker host is in a VM, that’s different from your 127.0.0.1 on your mac.

If you did docker run --rm -it -p 3000:3000 -v $(pwd):/usr/src/app sanchezjjose/my-node-app instead, it would bind to 0.0.0.0 (all interfaces). That would include the 192.168.99.100 IP, and then you’d be able to access it from your host.

/Jeff

1 Like