Score:0

Access other Docker containers from loadbalancer container using host network

ธง cn

For performance and usability (=dynamically reconfigure haproxy front- and backends on the fly without having to modify the systemd unit file that launches the container) I have a haproxy:2.5 container running using --net host that does SSL termination and load balancing.

Now, I want to access other containers on the host (e.g. a nginx container) from inside the haproxy container... but that doesn't work. Since we're running in the host network, the haproxy container uses the /etc/hosts from the host container (obviously) and so "nginx" does not resolve to anything.

I tried creating a separate network local-services which I can attach to the application containers, but attaching it to the haproxy container yields this error:

container sharing network namespace with another container or host cannot be connected to any other network

Is there any other way I can get both dynamic frontend ports in haproxy and connecting to application containers from inside haproxy, other than using e.g. -p 10.0.10.1:8080:80 on the container and 10.0.10.1:8080 in the haproxy backend specification?

โพสต์คำตอบ

คนส่วนใหญ่ไม่เข้าใจว่าการถามคำถามมากมายจะปลดล็อกการเรียนรู้และปรับปรุงความสัมพันธ์ระหว่างบุคคล ตัวอย่างเช่น ในการศึกษาของ Alison แม้ว่าผู้คนจะจำได้อย่างแม่นยำว่ามีคำถามกี่ข้อที่ถูกถามในการสนทนา แต่พวกเขาไม่เข้าใจความเชื่อมโยงระหว่างคำถามและความชอบ จากการศึกษาทั้ง 4 เรื่องที่ผู้เข้าร่วมมีส่วนร่วมในการสนทนาด้วยตนเองหรืออ่านบันทึกการสนทนาของผู้อื่น ผู้คนมักไม่ตระหนักว่าการถามคำถามจะมีอิทธิพลหรือมีอิทธิพลต่อระดับมิตรภาพระหว่างผู้สนทนา