This is a Dockerfile/image to build a container for nginx and php-fpm, with the ability to pull website code from git when the container is created, as well as allowing the container to push and pull changes to the code to and from git. The container also has the ability to update templated files with variables passed to docker in order to update your code and settings. There is support for lets encrypt SSL configurations, custom nginx configs, core nginx/PHP variable overrides for running preferences, X-Forwarded-For headers and UID mapping for local volume support.
If you have improvements or suggestions please open an issue or pull request on the GitHub project page.
|Docker Tag||GitHub Release||Nginx Version||PHP Version||Alpine Version|
For other tags please see: versioning
To pull from docker hub:
docker pull richarvey/nginx-php-fpm:latest
To simply run the container:
sudo docker run -d richarvey/nginx-php-fpm
To dynamically pull code from git when starting:
docker run -d -e 'GIT_EMAIL=email_address' -e 'GIT_NAME=full_name' -e 'GIT_USERNAME=git_username' -e 'GIT_REPO=github.com/project' -e 'GIT_PERSONAL_TOKEN=<long_token_string_here>' richarvey/nginx-php-fpm:latest
You can then browse to
http://<DOCKER_HOST> to view the default install files. To find your
DOCKER_HOST use the
docker inspect to get the IP address (normally 172.17.0.2)
For more detailed examples and explanations please refer to the documentation.
- Building from source
- Config Flags
- Git Auth
- Git Commands
- Repository layout / webroot
- User / Group Identifiers
- Custom Nginx Config files
- Scripting and Templating
- Lets Encrypt Support
- PHP Modules
- Logging and Errors
Could you remove instruction
VOLUME /var/www/html from the bottom of your docker file? Because it create following problem:
COPY ./composer.json .
COPY ./composer.lock .
RUN composer install --no-scripts --no-autoloader
CMD while true; do sleep 1000; done
When you run above docker file the 'vendor' directory will NOT exists in '/var/www/html' (even you remove this composer instruction and try just to create file by
touch somefile or dir
mkdir somedir you will unable to do it)
This problem is related with this :
Thanks guy. Does this version contain php-pecl-gearman, i install flow the instruction here https://github.com/ngineered/nginx-php-fpm/blob/master/docs/php_modules.md
but found no ext-name. Many thanks
Great job man!
Application is getting broken with the latest version.
I used the docker image tag php7 and it worked. Not sure how the future going to be with PHP.
php7 tag is back but unsupported
would php oci8 be included? for oracle.
I agree with @touhid on that - it would be helpful to keep the php7 tag, and also the /var/log/php7/ folder so we can pip PHP logs to stderr with:
RUN ln -sf /dev/stderr /var/log/php7/error.log
Please keep the "php7" tag. Latest tag and "php7.1" is breaking some applications .
@majest also if you need to use a specific version take a look at: https://github.com/ngineered/nginx-php-fpm/blob/master/docs/versioning.md you'll see you can still use PHP 7.1.1 if you don't use the latest tag
@majest this reference - > /www/site/web/index.php is that something in your code?