Let's take a look at how to connect our service containers to our data volume container. First, we have to run our data volume container, then run our MySQL container, and lastly run our WordPress container, as shown in the following command:
docker run -d --name data-one oskarhane/data tail -f /dev/null docker run --name mysql-one --volumes-from data-one -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql docker run --name wordpress-one --volumes-from data-one --link mysql-one:mysql -d -p 80 oskarhane/wordpress
Here, we have fired up and named the data volume container data-one
. The next line fires up the MySQL container, named mysql-one
, and gives it the data volume container. The last line fires up our WordPress container, named wordpress-one
, links mysql-one
as the MySQL link, and gives it the data volume container.
The following output is displayed:
Open your web browser and head over to the container's URL and port in order to verify that all the services...