Skip to content

Instantly share code, notes, and snippets.

@wzulfikar
Last active Dec 4, 2020
Embed
What would you like to do?
Setup wordpress using docker. Tested on Ubuntu.
#!/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/
@wzulfikar
Copy link
Author

wzulfikar commented Dec 4, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment