Container running nginx, php-fpm, memcached, mysql and www/mysql data is persistent
100K+
Multiple processes inside the container managed by supervisord:
Look at this repository for example (https://github.com/robinostlund/demo-website) If git repo requires a ssh key, put that key in /data/git_key/id_rsa
You can then trigger git pull from this command:
docker exec <mydockername> /usr/local/bin/run.git.pull.sh
Without website from git:
$ docker run -dt \
--name httptest \
--hostname httptest \
-p 8080:80 \
-v /tmp/test:/data \
-e MYSQL_DB_NAME=testdb \
-e MYSQL_DB_USER=test_user \
-e MYSQL_DB_PASS=test_pass \
-e MYSQLDUMP_ENABLED=true \
-e NGINX_X_FORWARDED_FOR=true \
-e MEMCACHED_ENABLED=true \
-e MEMCACHED_MEM=128m \
robostlund/nginx-php-mysql-static:latest
With website from git:
$ docker run -dt \
--name httptest \
--hostname httptest \
-p 8080:80 \
-v /tmp/test:/data \
-e MYSQL_DB_NAME=testdb \
-e MYSQL_DB_USER=test_user \
-e MYSQL_DB_PASS=test_pass \
-e MYSQLDUMP_ENABLED=true \
-e NGINX_X_FORWARDED_FOR=true \
-e MEMCACHED_ENABLED=true \
-e MEMCACHED_MEM=128m \
-e GIT_WEBSITE_REPO=https://github.com/robinostlund/demo-website.git \
-e GIT_WEBSITE_BRANCH=master \
-e GIT_WEBSITE_CRON_PULL=true \
robostlund/nginx-php-mysql-static:latest
Without website from git:
- name: create container
docker_container:
name: 'www01'
hostname: www01
image: robostlund/nginx-php-mysql-static:latest
recreate: yes
pull: true
ports:
- "8080:80" # http
volumes:
- '/tmp/data:/data'
env:
MYSQL_DB_NAME: my_mysql_db
MYSQL_USER: my_mysql_user
MYSQL_PASSQWORD: my_mysql_password
MYSQLDUMP_ENABLED: yes
NGINX_X_FORWARDED_FOR: yes
MEMCACHED_ENABLED: yes
With website from git:
- name: create container
docker_container:
name: 'www01'
hostname: www01
image: robostlund/nginx-php-mysql-static:latest
recreate: yes
pull: true
ports:
- "8080:80" # http
volumes:
- '/tmp/data:/data'
env:
MYSQL_DB_NAME: my_mysql_db
MYSQL_USER: my_mysql_user
MYSQL_PASSQWORD: my_mysql_password
MYSQLDUMP_ENABLED: yes
NGINX_X_FORWARDED_FOR: yes
MEMCACHED_ENABLED: yes
GIT_WEBSITE_REPO: 'https://github.com/robinostlund/demo-website.git'
GIT_WEBSITE_BRANCH: 'master'
GIT_WEBSITE_CRON_PULL: yes
Content type
Image
Digest
Size
206.6 MB
Last updated
over 6 years ago
docker pull robostlund/nginx-php-mysql-static