Zero volumes
Before we look at volumes, let's look at what happens when you do not use any volumes at all and store everything directly on the containers.
To start with, let's create a new Docker instance called chapter03
locally using Docker Machine:
docker-machine create chapter03 --driver=virtualbox eval $(docker-machine env chapter03)
Now that we have our machine, we can use Docker Compose to run through a scenario with WordPress. First of all, we will need to launch our WordPress containers, we are using the official WordPress and MySQL images from the Docker Hub as we did earlier, our docker-compose.yml
file looks similar to the following code:
version: '2' services: wordpress: container_name: my-wordpress-app image: wordpress ports: - "80:80" links: - mysql environment: WORDPRESS_DB_HOST: "mysql:3306" WORDPRESS_DB_PASSWORD: "password" mysql: container_name: my-wordpress-database ...