/docker-wordpress

Primary LanguageShellMIT LicenseMIT

lnoering/docker-wordpress

Wordpress with docker-compose Maintained - Yes

Run WP with docker-compose.

Table of contents

How to Use

New Projects

# Create your project directory then go into it:
mkdir -p ~/projects/wordpress
cd $_

# Download the Docker Compose template:
curl -s https://raw.githubusercontent.com/lnoering/docker-wordpress/master/lib/template | bash

# Download the version of WordPress you want to use with:
bin/download 6.2.2
# You can specify the version 
# If no arguments are passed, "6.2.2" is the default value used.

# Run the setup installer for WordPress:
bin/setup wordpress.localhost

open https://wordpress.localhost

Existing Projects

# Take a backup of your existing database:
bin/mysqldump > ~/projects/existing/wordpress.sql

# Create your project directory then go into it:
mkdir -p ~/projects/wordpress
cd $_

# Download the Docker Compose template:
curl -s https://raw.githubusercontent.com/lnoering/docker-wordpress/master/lib/template | bash

# Replace with existing source code of your existing WordPress instance:
cp -R ~/projects/wordpress src
# or: git clone git@github.com:myrepo.git src

# Start some containers, copy files to them and then restart the containers:
bin/start --no-dev
bin/copytocontainer --all ## Initial copy will take a few minutes...

# Import existing database:
bin/mysql < ../existing/wordpress.sql

# Update database connection details to use the above Docker MySQL credentials:
# Also note: creds for the MySQL server are defined at startup from env/db.env
# vi src/wp-config.php

Thanks to Markshust - I used the docker from him to do this one.