What to do when wordPress files are not in the project directory

In creating docker-compose.yml file, it is important to take note that everything you set is needs to be correct. This blog is about containerized WordPress where the files is not properly located. You only need to edit the docker-compose.yml file to solve this problem.

Step 1: Cut down the running WordPress containers

in your WordPress project directory, cut down the two containers

$ docker-compose down

Step 2: Edit docker-compose.yml file

$ sudo nano docker-compose.yml

Once you are inside the file, edit it by adding the following under wordpress

    volumes:
      ["./:/var/www/html"]

It should look like this

Save it by pressing CTRL + X then press Y and hit ENTER

You can look inside the WordPress project file and you can see now the missing files.

Step 3: Run docker containers

You can now start docker containers again after you changed the docker-compose.yml file by

$ docker-compose up -d

Leave a Comment

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