Customized version of https://registry.hub.docker.com/u/richarvey/nginx-php-fpm/
10K+
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 |
|---|---|---|---|---|
| php7 | php7 Branch | 1.17.8 | 7.3.13 | 3.11 |
To pull from docker hub:
docker pull richarvey/nginx-php-fpm
To simply run the container:
sudo docker run -d boro/nginx-php-fpm:php7
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.
The following flags are a list of all the currently supported options that can be changed by passing in the variables to docker with the -e flag.
/var/www/html to your own settingTo dynamically pull code from git (master branch) 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>' boro/nginx-php-fpm:php7
To pull a repository and specify a branch add the GIT_BRANCH environment variable:
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>' -e 'GIT_BRANCH=stage' richarvey/nginx-php-fpm:latest
You can pass the container your personal access token from your git account using the GIT_PERSONAL_TOKEN flag. This token must be setup with the correct permissions in git in order to push and pull code.
Since the access token acts as a password with limited access, the git push/pull uses HTTPS to authenticate. You will need to specify your GIT_USERNAME and GIT_PERSONAL_TOKEN variables to push and pull. You'll need to also have the GIT_EMAIL, GIT_NAME and GIT_REPO common variables defined.
Sometimes you need a custom config file for nginx to achieve this read the Nginx config guide
Please see the Scripting and templating guide for more details.
Specify the GIT_EMAIL and GIT_NAME variables for this to work. They are used to set up git correctly and allow the following commands to work.
To push code changes made within the container back to git run:
sudo docker exec -t -i <CONTAINER_NAME> /usr/bin/push
In order to refresh the code in a container and pull newer code from git run:
sudo docker exec -t -i <CONTAINER_NAME> /usr/bin/pull
All logs should now print out in stdout/stderr and are available via the docker logs command:
docker logs <CONTAINER_NAME>
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.
Content type
Image
Digest
Size
78.2 MB
Last updated
over 9 years ago
docker pull boro/nginx-php-fpm