-2
  • I created two containers php-fpm and nginx
  • My native IP is 192.168.1.12
  • I want the php-fpm container to connect to the redis service provided by one of the machines on the LAN
  • php-fpm container IP is 172.25.0.4
  • nginx container IP is laradock_frontend 172.24.0.3 laradock_backend 172.25.0.5 a LAN has two segments: 192.168.1.0/24 and 192.168.10.0/24, redis service on 192.168.10.0/24 network segment, my own machine is on the 192.168.1.0/24 network segment.
  • The document says that it can be configured as REDIS_HOST=redis

This is not suitable for me, I directly specify 192.168.10.244 display Connection refused [tcp://192.168.10.244:6379]

what should I do?

sowork
  • 1
  • 1
  • 4

1 Answers1

0

If I understand correctly, you have two containers running nginx and php-fpm services on your computer with IP 192.168.1.12, and you're trying to reach a computer with IP 192.168.10.244 from one of the containers.

I'd try ensure both containers are on same network, created using bridge driver:

docker network create --driver bridge my-network
docker run --name nginx --network my-network nginx:stable ...
docker run --name php-fpm --network my-network php:rc-fpm ...
oldhomemovie
  • 14,621
  • 13
  • 64
  • 99
  • thank you for your answer. I want to access redis services provided by other segments of the LAN through the php-fpm container – sowork Jul 11 '19 at 16:11