Hello,
I’m new to docker.
Just trying to create 2 containers for WordPress and MySQL.
I’ve created MySQL container like this:
$ docker run --name mydb -e MYSQL_ROOT_PASSWORD=123 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_NAME=wordpress -d mysql
Then I created WordPress container and linked it to MySQL container like this:
$ docker run -d -p 80:80 --name mywordpress --link mydb wordpress
Now When I try to install WordPress, I entered the following values for DB connection:
Database Name:wordpress
Username:root
Password:123
Database Host:mydb
Table Prefix:wp_
It cannot connect to MySQL container. Why?
I logged into the MySQL container and got the hostname and entered it into the hostname field, also doesn’t work.
Any idea why?
Thanks in advance.