Hello docker community! I’m new here and looking for some guidance on integrating Docker into our workflow for custom WordPress theme development.
Currently, we’re a team of 3 developers and sometimes we contract out freelancers. We would like to be able to create the same dev environment for all of us using a Docker container. From my understanding of Docker, it seems as the most logical way to go about this for a project that already exists would be to:
-Create a local directory, let’s call it
wp-docker-setup and import everything from
wp-content into it
docker-compose.yaml file that looks like the following:
version: '3' services: db: image: mysql:5.7 volumes: - ./wp-data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: wordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:latest volumes: - .:/var/www/html/wp-content/ ports: - "80:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress volumes: db_data:
-Mount the current directory as a volume –
-Mount the db file so it’s imported into mysql and loads with the site.
^Here’s where I’m stuck
My questions are:
- Where do I put the db file so that it’s mounted when I
- After the container is composed and running, let’s see I make changes that affect the db, how could I access the db in order to export the new file?
I’ve been researching this for the past few days but haven’t had much luck… I was able to figure out mounting the themes but mounting the db and then later being able to access it has stumped me.
Any guidance/suggestions on where to look or how to answer these questions is really appreciated. Thank you in advance!