Добрый день, пытаюсь разобраться с docker, настроил compose, всё работает за одним исключением, при попытке подключиться к mysql получаю ошибку: "SQLSTATE[HY000] [2002] Connection refused".
docker-compose.yml:
version: "3.1"
services:
memcached:
image: memcached:alpine
container_name: tkdruzhba-memcached
redis:
image: redis:alpine
container_name: tkdruzhba-redis
mysql:
image: mysql:8.0
container_name: tkdruzhba-mysql
working_dir: /application
volumes:
- .:/application
environment:
- MYSQL_DATABASE=dev
- MYSQL_USER=dev
- MYSQL_PASSWORD=devpass
- MYSQL_ROOT_PASSWORD=root
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
- PMA_ARBITRARY=1
- PMA_HOST=mysql
restart: always
ports:
- 8083:80
volumes:
- /sessions
webserver:
image: nginx:alpine
container_name: tkdruzhba-webserver
working_dir: /application
volumes:
- .:/application
- ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "8080:80"
php-fpm:
build: phpdocker/php-fpm
container_name: tkdruzhba-php-fpm
working_dir: /application
volumes:
- .:/application
- ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.1/fpm/conf.d/99-overrides.ini
php-fpm/Dockerfile:
FROM phpdockerio/php71-fpm:latest
WORKDIR "/application"
# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive
# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install php-memcached php7.1-mysql php-redis php7.1-ldap \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
# Install git
RUN apt-get update \
&& apt-get -y install git \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*