Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

213
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda