Skip to content

baracatuemura/wordpress-docker-compose

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPDC - WordPress Docker Compose

Easy setup local WordPress development enviroment with Docker and Docker Compose.

With this project you can quickly run the following:

Requirements

Make sure you have the latest versions of Docker and Docker Compose installed on your machine.

MacOS:

Install Docker, Docker-compose and Docker-sync.

Windows:

Install Docker, Docker-compose and Docker-sync.

Linux:

Install Docker and Docker-compose.

Make sure to add your user to the docker group when using Linux.

How to use

Execute in your terminal, change the WPFOLDER to use the name of your project:

Clone repository

git clone https://github.com/baracatuemura/wordpress-docker-compose.git WPFOLDER

For new WordPress instalation

cd WPFOLDER
cp env.example .env
./start
cp -R wp-app/wp-content/themes/ src/
cp -R wp-app/wp-content/plugins/ src/

In browser go to http://127.0.0.1

For WordPress existing source

cd WPFOLDER
cp env.example .env
mkdir wp-data
  • copy the database dump to wp-data folder
  • copy themes, plugins and uploads folders to src folder
./start

Replace data base URLs

docker-compose run --rm wpcli search-replace 'http://mysite.com' 'http://127.0.0.1'

In browser go to http://127.0.0.1

Configuration

Copy the example environment into .env

cp env.example .env

Edit the .env file to change the default IP address, MySQL root password and WordPress database name.

Usage

Starting containers

You can start the containers with the up command in daemon mode (by adding -d as an argument) or by using the start command:

./start

or

docker-compose up

or

docker-compose start

Stopping containers

./stop

or

docker-compose stop

Removing containers

To stop and remove all the containers use thedown command:

docker-compose down

To Stops containers and removes containers, networks, volumes, and images created to the specific project

./kill

or

docker-compose down -v

Creating database dumps

./export.sh

WP CLI

The docker compose configuration also provides a service for using the WordPress CLI.

Sample command to install WordPress:

docker-compose run --rm wpcli core install --url=http://localhost --title=test --admin_user=admin [email protected]

Or to list installed plugins:

docker-compose run --rm wpcli plugin list

Or to search-replace:

docker-compose run --rm wpcli search-replace 'http://mysite.com' 'http://wp-app.local'

Create new admin user

docker-compose run --rm wpcli user create baracat [email protected] --role=administrator --user_pass=newpass

For an easier usage you may consider adding an alias for the CLI:

alias wp="docker-compose run --rm wpcli"

This way you can use the CLI command above as follows:

wp plugin list

phpMyAdmin

You can also visit http://127.0.0.1:8080 to access phpMyAdmin after starting the containers.

The default username is root, and the password is the same as supplied in the .env file.

License

This project is based in Harald Nezbeda docker environment: https://github.com/nezhar/wordpress-docker-compose

About

Easy Wordpress development with Docker and Docker Compose

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 95.2%
  • PHP 4.8%