I tried a simple tutorial to up and run WordPress in multi-container by following simple commands.
docker pull mysql docker pull wordpress docker run --name yourSql -e MYSQL_ROOT_PASSWORD=abc123 -d mysql:latest docker run --name letterPress --link yourSql:mysql -p 8888:80 -d wordpress
everything runs perfectly fine, and if I access wordpress container with its ip address and port like http://172.18.0.2:8888
This starts a wizard of WordPress where this wizard does not ask any credentials related to MySQL (hostname, database name, username and password)
However, if I try to run these both
containers in a docker
network then it ask me all the credentials (now it's not automatic)
docker network create blog-network docker run --name yourSql --net blog-network -e MYSQL_ROOT_PASSWORD=abc123 -d mysql:latest docker run --name letterPress --net blog-network --link yourSql:mysql -p 8888:80 -d wordpress
Now if I access the WordPress container with url, the wizard starts but this time it asks me about all the credentials related to MySQL.
so my question is why now it's asking about the credentials?