I currently have several containers running inside docker which is handled by docker-compose file.
The roughly content of the docker compose file looks like below
app1:
container_name: app1
depends_on:
- app2
image: someimagepath
build:
context: ./app1
dockerfile: Dockerfile
ports:
- 127.0.0.1:81:80
expose:
- "80"
networks:
- datanet
app2:
....
Question: How can I make it so that the app1 can be accessible by my other PC so that I can hit the URL like http://<LAN-IP>: 80
and connect to it?
Thanks
Your PC needs to access the Mac, so it needs the IP address of the Mac (suppose 192.168.1.3).
Suppose your Mac has Internal Network IP 192.168.1.3 From the PC you do: http://192.168.1.3 But then it enter the Mac on port 80.
Somehow you need to forward requests on the Mac to port 80 to your App1 Container. You need a ProxyServer for that, like Nginx.
Basically is comes down to realising that your PC cannot access a Docker Container running on another system directly. You something on the Host (where the container is running) to forward requests to that container.
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.