简体   繁体   中英

Docker cannot connect to the host machine

Im trying to set up a connection between my Docker container and my host that it is run on. Ive read Access host database from a docker container , and added the host ip to the hostfile of the Docker container, however it still will not respond to pings.

Im hosting my servers on an AWS box, and the ports 80, 8080 are open.

How can I get the host sever to respond to pings from the container?

Thanks.

You can run Docker container using "--net=host" option, then the container will share the same network namespaces with the host node.

For example:

sudo docker run -it --net=host ubuntu:14.04 bash

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