Connect to WordPress Docker Container
I created a Docker Container App on Azure that includes a WordPress container and a MySQL container. When I run the following command:
docker run ps
I see the two containers.
I can connect to the MySQL container file system using this command:
docker run -i -t mysql:latest /bin/bash
If I try to connect to the WordPress container file system using the same command, such as…
docker run -i -t wordpress:latest /bin/bash
…it doesn’t work. Instead it gives me this message:
Did you forget to –link some_mysql_container:mysql or set an
external db with -e WORDPRESS_DB_HOST=hostname:port?
It makes sense I guess that it want’s me to reference the MySQL container. But, I’ve tried various versions of –link and cannot get it to work.
Can someone help me with the Docker syntax? I just want to make some changes to the file system in this container.
Thanks in advance!
2 Solutions collect form web for “Connect to WordPress Docker Container”
On the other side, if you need to run WordPress container in interactive mode (as you attempted), you’ll need to specify the –link like this:
docker run --link compose990242913_mysql_1:mysql -i -t wordpress:latest /bin/bash
when you do
docker run ... you are not connecting to the running containers displayed by the
docker ps command. What you are actually doing is creating and running additional containers from the docker images
If you want to open a bash shell in the running container named
compose990242913_wordpress_1 then you need to execute the following command:
docker exec -i -t compose990242913_wordpress_1 /bin/bash
Once you are in that shell, make sure to quit properly by typing the
exit command or you might leave processes behind in that container.