简体   繁体   中英

Is there a way to allow Docker Container to connect to host but not to internet

I want to connect my container to host but not to internet ie It should be a able to connect to a non container process on host eg: localhost:5000

but not to internet

If you are executing calls from inside a container and you want to address your host , then you cannot use the localhost address (because that would still point to the inside of the container).

So, what you need to do, is use the 0.0.0.0 address ( 0.0.0.0:5000 in your case).

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