Git Product home page Git Product logo

Comments (2)

ReinerNippes avatar ReinerNippes commented on July 27, 2024

Two ways to configure docker container.

  1. The image has a mechanism for this. Typically it's an env variable. You go to https://hub.docker.com/_/wordpress Read the doc and guess that "-e WORDPRESS_CONFIG_EXTRA=... (defaults to nothing, non-empty value will be embedded verbatim inside wp-config.php -- especially useful for applying extra configuration" will do the trick.

To check this you go to https://github.com/docker-library/wordpress to look in the Dockerfile or the docker-entrypoint.sh

And in line 151 you see that the content of WORDPRESS_CONFIG_EXTRA is copied into wp-config.php
https://github.com/docker-library/wordpress/blob/0df5de06a4f43f2790dfc3be92554a7e229115d9/php7.3/fpm-alpine/docker-entrypoint.sh#L151

Looks good. For me.

So I would define a variable app_php_config in https://github.com/ReinerNippes/selfhosted_on_docker/blob/master/group_vars/wordpress.yml
And add to the docker task https://github.com/ReinerNippes/selfhosted_on_docker/blob/master/roles/docker_wordpress/tasks/wordpress.yml#L5 an env: parameter https://docs.ansible.com/ansible/latest/modules/docker_container_module.html#parameter-env
You may test it without the variable definition.

  1. If that doesn't work. You have to find the place of the php config files in the container. Dockerfile/docker-entrypoint.sh are again a good start. Seems that /usr/local/etc/php is the path you have to look for. https://github.com/docker-library/wordpress/blob/0df5de06a4f43f2790dfc3be92554a7e229115d9/php7.3/fpm-alpine/Dockerfile#L53
    You may log into the container with a command like this docker exec -it app-wordpress /bin/sh and examine how the php is read. I guess there is a include /usr/local/etc/php/conf.d/*.php somewhere. To get your config inside the container you create a file on the host and add this as a volume to the container.
    The syntax you can find here:

from selfhosted_on_docker.

Nickous avatar Nickous commented on July 27, 2024

Waouhh!! very well documented. Thank you for your very helpful help.
I choose option 2 and add the php.ini file in /usr/local/etc/php/conf.d/ with a volume command.
https://github.com/Nickous/selfhosted_on_docker/commit/5bea4a358ceab8f2a401f738cd0cae6d6e07fd8e

from selfhosted_on_docker.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.