简体   繁体   中英

Access ubuntu localhost from node server inside docker container

I have a node server running inside a docker container and the docker container is running in ubuntu 16.04. I have service running on the ubuntu localhost. I am trying to access that localhost from the node server but keeps getting ECONNREFUSED. Is there any fix to this problem?

Maybe expose the node server port on a different port.

docker run -d -p <host_port>:<container_exposed_port> -t <image_name>

And access to the exposed port.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM