1

There is a question that asks about volumes, mine is a bit different.

What I'm interested in is that when I use a simple docker-compose.yml file

version: '3'
services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: password
       MYSQL_DATABASE: wordpress
       MYSQL_USER: user
       MYSQL_PASSWORD: password

   app:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     volumes:
       - .:/var/www/html/
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: user
       WORDPRESS_DB_PASSWORD: password
volumes:
    db_data:

The default image somehow downloads the entire WordPress installation to my host. How does it do that?

I'm asking, because I have a custom Dockerfile in which I ADD the wp zip file, unzip it and put the contents to /var/www/html which is mapped in my docker-compose.yml file in the ../:/var/www/html (my docker-compose.yml file is in the project-root/.docker/ folder so I map the project root to the WP root).

When I tried with the official image the contents were copied to my host, so I'm clearly missing some crucial part that is in the official images. But which one?

dingo_d
  • 11,160
  • 11
  • 73
  • 132

1 Answers1

0

So it turns out that you have to copy/download/install using wpcli the WP inside the entrypoint script, and native WP docker images are doing that. Either that or inside the CMD command.

It's the same with this question.

Once done there, all the files in the container will appear in the host as well.

dingo_d
  • 11,160
  • 11
  • 73
  • 132