Docker Compose WordPress, where are my WordPress files stored

Posted on

A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about Docker Compose WordPress, where are my WordPress files stored was one problem in server stack that need for a solution. Below are some tips in manage your windows server when you find problem about windows, docker, wordpress, , .

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.

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: {}

Leave a Reply

Your email address will not be published. Required fields are marked *