Multiple Docker Container
Hello I'm trying to run two different MySQL versions as docker containers, however when I want to connect a second wordpress blog, I'm greeted with this error message: Error establishing a database connection.
In the container logs everything is looking fine and I did change the network section and ports in my docker-compose.yml, but from looking at the container information I see that the MySQL container is still using 3306/tcp as port, even though I changed it with the environment variable MYSQL_TCP_PORT: 3307 and it is using this one as well.
Running two independent setups is mandatory.
Thank you for your replies!
docker-compose.yml
Credentials are sanitized
version: "3"
networks:
test:
name: test
ipam:
driver: default
config:
- subnet: 192.168.99.0/24
ip_range: 192.168.99.0/26
gateway: 192.168.99.1
attachable: true
services:
db2:
image: mysql:8.0.36
container_name: MySQL2
environment:
MYSQL_ROOT_PASSWORD: 1234
MYSQL_ONETIME_PASSWORD: True
MYSQL_USER: test
MYSQL_PASSWORD_FILE: 1234
MYSQL_DATABASE: db2
MYSQL_TCP_PORT: 3307
volumes:
- /Wordpress/MySQLTest/:/var/lib/mysql
ports:
- 3307:3307
networks:
- test
wordpress:
depends_on:
- db2
image: wordpress:6.4.0-php8.0-apache
container_name: Wordpress2
ports:
- "18888:80"
environment:
WORDPRESS_DB_HOST: db_dev:3307
WORDPRESS_DB_USER: test
WORDPRESS_DB_PASSWORD: 1234
WORDPRESS_DB_NAME: db2
volumes:
- /WordpressTest:/var/www/html
networks:
- test
Subject
Written By
Posted
Multiple Docker Container
February 13, 2024 11:48PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.