Hello!
It is my first exrerience with docker. I have a few containers: mysql, nginx, php7.1 and php 5.3. They are described into docker-composer.yml. If I configure my web-server through site conf-file for using php7.1, all works fine. But if I configure nginx for using php5.3, in this case I recieve error 111 Connection refused. I try to test connection to php53-container - port is closed. I can’t understand how to set it to open state
Is the php7 container running or does it exit? You see it if you run docker-compose in the foreground (without the -d flag). If it is running: Do you use the correct address and port to connect to it?
Both containers (php7 and php53) work in the same time. They use network named docker-lemp_default. I inspected this network using docker network inspect docker-lemp_default command.
Sometimes after docker restarting (using docker-composer restart command) containers can change own ip-address. Therefore nginx configured for using service name instead of IP:
location … { … fastcgi_pass php53:9000; … }
If I use php7 instead of php53 in this confguration all works fine.
tekki, I tried to write both services into docker-compose.yml, I tried to write only php7 and only php53 into docker-compose.yml. It has no any effect. All ports of php53 container are closed in any case. I used nmap utility to check ports of containers.
This is docker-compose.yml with both services:
The command docker network inspect docker-lemp_default shows that all containers belong to the same network
I forgot to say something. In other computer (ubuntu 18.04 like my computer) this php53 container has an opened port. In its case docker-compose.yml describes only three services: php7, web, mysql. However the php53 container works also. I tried to copy docker-compose.yml and Dockerfile-files from that computer to resolve my problem