Hi guys let me as about Docker..
so I have more Docker container and I successfully to connect container to each container with same network…
but if I set a proxy connection it make my container can not connect to each other container… what must i do guys?
here is my docker-compose.yml file
version: '3.7'
services:
membership:
container_name: membership_service
build:
context: ./membership
target: dev
ports:
- 6010:6010
volumes:
- ./membership:/app
network_mode: simas_net
proxy:
container_name: nginx_proxy
build:
context: ./proxy
target: dev
ports:
- 8000:80
volumes:
- ./proxy/config:/etc/nginx/conf.d
network_mode: simas_net
and here is proxy config
~/.docker/config.json
{
"proxies": {
"default": {
"httpProxy": "http://192.168.49.1:8000/",
"httpsProxy": "http://192.168.49.1:8000/",
"noProxy": "localhost,127.0.0.0/8"
}
}
}
thanks for you’re help guys
2
Answers
I change grpc client dial with no proxy option. it turns out about the grpc client can not connect to rpc server but rpc server can connect to each other, so I added with no proxy for rpc client dial connection and that is worked
This is not a big problem. Your
~/.docker/config.json
is configured to automatically set three proxy environment variables on starting containers.Now the software inside your containers seems to react to those variables (which is expected, you usually configure those settings, to have the containers use the proxy)
In your case however it seems that your server software picks those settings up and automatically tries to connect to the other container hostname over the proxy -> which fails because the proxy is not inside the container network, therefore he’s not able to help establishing the connection.
multiple solutions possible:
no_proxy
value with the others container name -> hope that the software will interpret it correctly (no_proxy
is not standardized)http_proxy
,https_proxy
,no_proxy
) inside your compose files for services who need this proxy for communication