Windows – Docker Compose WordPress, where are the WordPress files stored

dockerwindowsWordpress

I have successfully setup WordPress following the official instructions on docker's documentation. I am running windows and I can't seem to figure out where I edit my WordPress files such as wp-content so on so fourth. Here is my docker-compose.yml that I used to setup the container. Thanks ahead of time. Does it have something to do with the volumes setting? I shared my C drive with docker.

version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8080:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
volumes:
    db_data: {}

Edit: I would like to have my WordPress files in the same directory that I setup the container which is C:/Users/andersk/sites/wordpress.

Best Answer

This fixed it for me adding a volumes line pointing towards the folder on my C Drive

volumes: 
       - C:/Users/andersk/sites/wordpress-site:/var/www/html

See Above for line added

version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "3000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
     volumes: 
       - C:/Users/andersk/sites/wordpress-site:/var/www/html // This fixed it
volumes:
    db_data: {}