Trying to deploy site locally in Docker. Formerly site normally worked in OpenServer.
My docker-compose.yml:
version: '3.3'
services:
web:
build: .
container_name: php74-mysite
links:
- db
volumes:
- ./:/var/www/html/
- ./ports.conf:/etc/apache2/ports.conf
ports:
- 8083:83
db:
container_name: mysql-mysite
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mydb
MYSQL_USER: root
MYSQL_PASSWORD: root
ports:
- 6034:4306
volumes:
- ./var/mysql/db:/docker-entrypoint-initdb.d
# this gives nothing (((, I cannot see my DB in phpMyAdmin
networks:
- default
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- db:db
ports:
- 8085:85
environment:
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_ROOT_PASSWORD: root
Dockerfile:
FROM php:7.4-apache
RUN docker-php-ext-install mysqli pdo pdo_mysql
EXPOSE 83
Access to DB through PDO example, using these variables:
define('DB_NAME', 'mydb');
define('DB_USER', 'root');
define('DB_PASS', 'root');
define('DB_HOST', 'db');
When I start my app (docker-compose up
) it throws an exception "could not find driver". Besides, in phpMyAdmin my database looks empty, so mounting DB dump to mysql container gives nothing.
Text, printed in console:
Starting mysql-mysite ... done
Starting mysite_phpmyadmin_1 ... done
Starting php74-mysite ... done
Attaching to mysql-mysite, mysite_phpmyadmin_1, php74-mysite
mysql-mysite | 2021-02-27 21:10:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
phpmyadmin_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.3. Set the 'ServerName' directive globally to suppress this message
mysql-mysite | 2021-02-27 21:10:09+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
phpmyadmin_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.3. Set the 'ServerName' directive globally to suppress this message
phpmyadmin_1 | [Sat Feb 27 21:10:10.498472 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.15 configured -- resuming normal operations
phpmyadmin_1 | [Sat Feb 27 21:10:10.498504 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
mysql-mysite | 2021-02-27 21:10:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
mysql-mysite | 2021-02-27T21:10:09.904479Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 1
mysql-mysite | 2021-02-27T21:10:09.922093Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
mysql-mysite | 2021-02-27T21:10:10.119170Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysql-mysite | 2021-02-27T21:10:10.207155Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
mysql-mysite | 2021-02-27T21:10:10.240298Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
mysql-mysite | 2021-02-27T21:10:10.240444Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
mysql-mysite | 2021-02-27T21:10:10.242561Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql-mysite | 2021-02-27T21:10:10.256343Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
php74-mysite | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.4. Set the 'ServerName' directive globally to suppress this message
php74-mysite | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.4. Set the 'ServerName' directive globally to suppress this message
php74-mysite | [Sat Feb 27 21:10:10.591808 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.15 configured -- resuming normal operations
php74-mysite | [Sat Feb 27 21:10:10.591846 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
What do I configure incorrectly?
Source: Docker Questions