两个独立的Docker容器是否可以通过ZMQ IPC套接字进行通信?如果是这样,怎么能实现呢?@H_502_2@
例如:@H_502_2@
@H_502_2@
Docker Container #1 executes an application that creates a ZMQ Response socket and binds to “ipc://tmp/service_name”.@H_502_2@
Docker Container #2 executes an application that creates a ZMQ Request socket and connects to “ipc://tmp/service_name”.@H_502_2@
以下命令用于在两个单独的docker容器中运行应用程序:@H_502_2@
@H_502_2@
// Run container #1 (binds to "ipc://tmp/service_name")
docker run --name c1 -it container1
// Run container #2 (connects to "ipc://tmp/service_name")
docker run -it --link c1:container1 --name c2 container2
运行容器后,我无法建立ZMQ(IPC)连接.但是,我能够从容器2 ping容器1,并从容器1 ping容器2.@H_502_2@
我也尝试使用–ipc命令,但它没有帮助:@H_502_2@
@H_502_2@
// Run container #1 (binds to "ipc://tmp/service_name")
docker run --name c1 --ipc=host -it container1
// Run container #2 (connects to "ipc://tmp/service_name")
docker run -it --link c1:container1 --ipc=container:c1 --name c2 container2
更新:
我能够使用ZMQ TCP套接字在两个单独的Docker容器之间进行通信,但仍然无法使用IPC套接字进行通信.可能吗?
最佳答案