Where Docker stores files of images on Windows 10?

0

Issue

I work with WordPress and now I try to create WP site with Docker. However, I already have folder called ‘wp-content’ (with my old content) and I have to put it into new one (which I have just created with docker-compose.yml).
But I don’t understand where docker stores all theses files (ex. wp-admin, wp-content, wp-includes).

I have folder called wordpress-docker where I store my docker-compose.yml but it’s empty (I thought that new folders will appear here).

Here’s my docker-compose.yml:

version: "3.9"
    
services:
  db:
    image: mysql:8.0
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: somewordpress
      MYSQL_DATABASE: wordpress
      MYSQL_PASSWORD: wordpress
    
  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    volumes:
      - wordpress_data:/var/www/html
    ports:
      - "8000:80"
    restart: always
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
      WORDPRESS_DB_NAME: wordpress
volumes:
  db_data: {}
  wordpress_data: {}

P.S: tried this article: https://docs.docker.com/samples/wordpress/

Solution

I’ve used your docker-compose.yml with those updates :

version: "3.3"
    
services:
  ...
  wordpress:
    ...
    volumes:
      - ./wordpress_data:/var/www/html

I just added the "./" before the volume name.

Now you will find all your WordPress files in your local wordpress_data folder :
enter image description here

Then you can manipulate all the files locally and find the same content/structure inside the container.

PS : I’ve got a right access issue : I can’t maniuplate the folder locally, so I’ve forced the folder rights.

You can also change nothing and add this :

    volumes:
      - wordpress_data:/var/www/html
      - ./wordpress_data:/var/www/html/wp-content

Your local folder wordpress_data will ‘point’ to wp-content inside the container which is empty by default.

Answered By – Sami

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More