Wordpress Dockerized Environment.
Clone or download

README.md

Wordpress Dockerized Environment

PRs Welcome

This repository aims to simplify the setting up of a docker-compose development environment.

Pre-requirements

First, make sure you have the latest versions of Docker and Docker Compose installed on your machine.

From a new project

  • Download latest WordPress version.
  • Unzip wordpress-x.x.x.zip archive.
  • Move all files present in the unzipped folder to src/
  • Run docker-compose up.

From an existing project

  • Move all your files to src/.
  • Copy the SQL dump file to docker/dump/.
  • Update database credentials in docker-compose.yml with your own values.
  • Run docker-compose up.

Ready

There are two ways to access to your local WordPress:

# Directly from your local machine IP.
http://127.0.0.1:80

# From a local domain (cf: Utils/WordPress section), add below line in your /etc/hosts file.
127.0.0.1 wordpress.local

Docker Compose

# To start/restart your containers
$ docker-compose up

# To start/restart your containers in background
$ docker-compose up -d

# To stop all containers
$ docker-compose stop

# To stop and remove all containers
$ sudo docker-compose down

# To remove all stoped containers
$ docker-compose rm --all

# To connect you into wordpress container
$ docker-compose exec wordpress /bin/bash

# To connect you into mysql container
$ docker-compose exec mydb.mysql.db /bin/bash

WordPress

To override the hostname without changing any data in your database add in your wp-config.php the below lines:

define('WP_HOME','http://wordpress.local');
define('WP_SITEURL','http://wordpress.local');

Scripts

# To dump MySQL 
$ bash utils/dump.sh