Skip to content

Instantly share code, notes, and snippets.

@jdeathe
Last active March 14, 2017 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdeathe/d55340e6bdcc6c0c85652bf4f24b4fb1 to your computer and use it in GitHub Desktop.
Save jdeathe/d55340e6bdcc6c0c85652bf4f24b4fb1 to your computer and use it in GitHub Desktop.
docker-compose definition for a Wordpress environment with SSH access
# Requirement: https://github.com/jdeathe/centos-ssh/issues/472
#
# On CentOS-7 Host install docker-compose:
# sudo yum -y upgrade python*
# sudo yum -y install epel-release
# sudo yum -y install python-pip
# sudo pip install docker-compose
# OR Use container alias and add the following 2 environment variables to .env
# Ref: https://gist.github.com/jdeathe/e7b09222bb44a2efa6a67b893fe35ac1
#
# Example settings - to be replaced with your own values
# export MYSQL_ROOT_PASSWORD=b1o88er
# export SSH_USER_PASSWORD='$6$pepper$g5/OhofGtHVo3wqRgVHFQrJDyK0mV9bDpF5HP964wuIkQ7MXuYq1KRTmShaUmTQW3ZRsjw2MjC1LNPh5HMcrY0'
#
# Start the services:
# sudo -E docker-compose up -d
#
# Connect to the SSH container from a remote host
# ssh -p 8822 blogmin@{docker-host}
#
# Once connected set permissions to the SSH_USER account with the www-data (id 33) group.
# sudo chown -R blogmin:33 ~/html
#
# To complete the installation:
# http://{docker-host}:8980/
version: "2.0"
networks:
wb_db:
driver: "bridge"
volumes:
wp_db:
driver: "local"
wp_html:
driver: "local"
wp_php_conf:
driver: "local"
wp_ssh_keys:
driver: "local"
services:
ssh:
image: "jdeathe/centos-ssh:2.2.1"
volumes:
- "wp_html:/var/www/html"
- "wp_ssh_keys:/etc/ssh"
ports:
- "8822:22"
environment:
SSH_USER: "blogmin"
SSH_USER_ID: "65534:65534"
SSH_USER_HOME: "/var/www"
SSH_USER_PASSWORD_HASHED: "true"
SSH_USER_PASSWORD: "${SSH_USER_PASSWORD}"
SSH_AUTHORIZED_KEYS: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCVGVvaK4hk00PYfkDFcC/7HzT08hxwUAy+91E1HDHQv76W5v8LN50duaQ78x5N0BgliijnA0Ql1WxcgTKkL+yvYN0Mjkfr8tnnL9GGwySv4OWJDZaWieDqFkRtWN2R38M8YUBKO4ZWvTntY4CQn+pC3f18PbqqvoSKMSEK2qlg3nDgGpaIrwThMGJro9jqOIhEyu2eM8BKrgd/VHPGu3bLwutiLvCjiFgVMDiclvun8407AgKwgzc4yfQlljz4nV2irVMkYy0ambNPIk14Js82G/IeC6SBnf80cv3uiNmBUi0jbDJfxRZNvJ5inelYbXgU5PCOxotWZAC3QHQversl"
restart: "always"
wordpress:
image: "wordpress:4.7-php7.0-apache"
depends_on:
- "wordpress_db"
environment:
APACHE_RUN_USER: "nobody"
APACHE_RUN_GROUP: "www-data"
WORDPRESS_DB_HOST: "wordpress_db"
WORDPRESS_DB_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
links:
- "wordpress_db"
networks:
wb_db:
aliases:
- "wordpress"
ports:
- "8980:80"
volumes:
- "wp_html:/var/www/html"
- "wp_php_conf:/usr/local/etc/php/conf.d"
restart: "always"
wordpress_db:
image: "mariadb:10.1.21"
environment:
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
networks:
wb_db:
aliases:
- "wordpress_db"
volumes:
- "wp_db:/var/lib/mysql"
restart: "always"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment