Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda