简体   繁体   中英

How can I run a Docker container that can reach LAN?

Given that I have a Docker image, which defines a container that has a server inside, listening on some port, I want to be able to deploy it in LAN so that the server itself can reach out to any other computing instance or smart device within the given range of private IP addresses, that defines the private network.

How can I achieve that? The goal is to have this deployment automated and to be able to deploy in different LANs with minimal manual intervention.

You need to use the concept of port mapping. Just map the listening port of the server in docker image to any port of host machine during run.

  docker run -p <host_machine_port>:<docker_server_listening_port> <image_name>

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