I'm trying to create 2 Docker containers, one containing a MySQL database and another containing Apache/PHP and MediaWiki. I'm using the latest images up on Docker Hub for MySQL and MediaWiki.
I'm creating the 2 containers using:
docker container run -d --name mediawiki --restart always -p 8080:80 mediawiki
docker container run -d --name mw-mysql -v mw-mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD="Sup3rS3cret" -p 3306:3306 --restart always mysql
I'm not sure that I need to map the MySQL port (3306) since that's the default. I'm also pretty sure that nothing is listening on port 80 so I probably don't need to map it to 8080 either.
I also create a network and add both containers to the network:
docker network create mediawiki
docker network connect mediawiki mediawiki
docker network connect mediawiki mw-mysql
From the host where Docker is running, I can fire up a mysql client and connect to the MySQL database running in mw-mysql. If I log into the mediawiki container, I can ping the mw-mysql container.
The images are downloaded and created just fine but when I browse to the MediaWiki website at http://localhost:8080/ and start to configure MediaWiki, it can't connect to the database.
I've the following servers: "mw-mysql", "my-mysql.mediawiki", "localhost", "127.0.0.1" along with the userid "root" and the super secret password above.
I'm stumped. I'm also new to Docker. I must be doing something stupid but I just don't see it. All suggestions gratefully accepted.