The default volume driver
Before we start using the third-party volume plugins, we should take a look at what ships with Docker and how volumes solve the scenario we just worked through. Again, we will be using a docker-compose.yml
file; however, this time, we will add a few lines to create and mount volumes:
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" volumes: - "uploads:/var/www/html/wp-content/uploads/" mysql: container_name: my-wordpress-database image: mysql environment: MYSQL_ROOT_PASSWORD: "password" volumes: - "database:/var/lib/mysql" volumes: uploads: driver: local database: driver: ...
Get Extending Docker now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.