Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

212
Views
WordPress image with pre-installed plugins using Dockerfile

Copying plugin folder to WordPress default image directory and creating a new image. Pushing it to the repository on Docker Hub, then pull back image and run the container, but the plugin is not installed. Folder is not found in the container.

docker-compose.yml

version: '3.3'
services:
  wp:
    image: "arslanliaqat/wordpresswithplugin:1.0"
    volumes:
      - './wordpress:/var/www/html'
    ports:
      - "8000:80"
    environment:
      WORDPRESS_DB_PASSWORD: qwerty
  mysql:
    image: "mysql:5.7"
    environment:
      MYSQL_ROOT_PASSWORD: qwerty
    volumes:  
      - "my-datavolume:/var/lib/mysql"
volumes: 
  my-datavolume:

Dockerfile

FROM wordpress:php7.1-apache

COPY preferred-languages /var/www/html/wp-content/plugins/preferred-languages/

could not pre-install plugin

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

So this is what's happening:

When you are building your custom image, you add the plugin folder /var/www/html/wp-content/plugins/preferred-languages/ and that works just fine.

You can test that by simply running docker run -it --rm arslanliaqat/wordpresswithplugin sh and cd /var/www/html/wp-content/plugins and you should see the folder.

The reason the folder is missing when you are using your docker-compose.yml file is because you are mounting the volume "over" the folder that's already there. Try removing the volumes declaration from wp service in the docker-compose.yml file and then you should be able to see your plugin folder.

I would suggest you use the wordpress:php7.1-apache for your wp service and mount your plugin folder the same way you are mounting wordpress

Example:

version: '3.3'
services:
  wp:
    image: "wordpress:php7.1-apache"
    volumes:
      - './wordpress:/var/www/html'
      - './preferred-languages:/var/www/html/wp-content/plugins/preferred-languages'
    ports:
      - "8000:80"
    environment:
      WORDPRESS_DB_PASSWORD: qwerty
  mysql:
    image: "mysql:5.7"
    environment:
      MYSQL_ROOT_PASSWORD: qwerty
    volumes:  
      - "my-datavolume:/var/lib/mysql"
volumes: 
  my-datavolume:

Is there a specific reason you need the plugin to be in the image already?


UPDATED

I created a simple gist which should accomplish what you want to do. The entrypoint lacks checks for already existing theme/plugin directories etc, but this should serve as POC

https://gist.github.com/karlisabe/16c0ccc52bdf34bee5f201ac7a0c45f7

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!