Last active
December 4, 2020 08:45
-
-
Save wzulfikar/dbe9aba875763bd98fd2f5e7b5e1ab6b to your computer and use it in GitHub Desktop.
Setup wordpress using docker. Tested on Ubuntu.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# File: /opt/wordpress/run.sh | |
APP_NAME=acme-blog | |
WORKDIR=/opt/wordpress | |
if [ ! -f "uploads.ini" ]; then | |
touch ${WORKDIR}/uploads.ini | |
fi | |
docker run -d --restart unless-stopped --env-file ${WORKDIR}/.env --name ${APP_NAME} \ | |
-v ${WORKDIR}/wp-content:/var/www/html/wp-content \ | |
-v ${WORKDIR}/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini \ | |
wordpress:latest | |
# If docker has no write access to wp-content, wordpress will ask you for FTP details | |
# when you want to install plugins. This command will allow docker to have write access | |
# to wp-content. | |
docker exec ${app_name} chown -R www-data:www-data /var/www/html/wp-content/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script will not expose wordpress container to the world.
You may want to consider setting up nginx with automated https using docker. See: https://gist.github.com/wzulfikar/957917c8ad84a6047bdb0831215daa51