I am currently trying to configure a new server running Ubuntu 16.04 LTS.
There is one application running outside docker: My nginx reverse proxy / webserver. This should not interfere because it only listens on port 80 and 443. Accessing the PMA Interface works fine.
Currently there are 3 Docker Containers running: a PHP-FPM Container (which handle php processing coming from nginx), MySQL and phpMyAdmin. All 3 of them are created by docker-compose, the .yml file looks as follows:
version: "3"
services:
php-fpm:
build:
context: /srv/docker/dockerfiles/php-fpm
image: php-fpm:latest
ports:
- 9000:9000
volumes:
- "/srv/docker/volumes/php-fpm/config/:/usr/local/etc/php/"
- "/srv/docker/volumes/php-fpm/ssh/:/root/.ssh/"
- "/srv/www/:/srv/www/"
- "/srv/docker/volumes/php-fpm/logs/:/var/log/php-fpm/"
restart: unless-stopped
mysql:
image: mysql/mysql-server:latest
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=<insert secure password>
- MYSQL_ROOT_HOST=sintra01
volumes:
- "/srv/docker/volumes/mysql/:/var/lib/mysql"
restart: unless-stopped
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- 8080:80
- 8443:443
environment:
- PMA_HOST=sintra01
- PMA_PORT=3306
volumes:
- "/srv/docker/volumes/phpmyadmin/config/:/etc/phpmyadmin/"
restart: unless-stopped
(please ignore the masses of volumes, I know this is bad)
Now, this does not work. When clicking on login in the PMA login form, the following error message appears:
#2002 - No such file or directory — The server is not responding
and mysqli_real_connect(): (HY000/2002): No such file or directory
Running the PMA Container manually by using
sudo docker run --name myadmin -d -e PMA_HOST=sintra01 -p 8080:80 -p 8443:443 phpmyadmin/phpmyadmin
it works perfectly. I can also connect to the DB by using e.g. MySQL Workbench, regardless of using compose or docker run. So I guess the culprit has to be docker-compose in some way.
EDIT: OK, I apparently it also affects the php container. I cannot connect to the database from any php script.