Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ivialex/challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordPress

WordPress development with Docker and Docker Compose.

I used this projects in my WordPress development:

Contents:

Requirements

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

Clone this repository or copy the files from this repository into a new folder. In the docker-compose.yml file you may change the IP address, Port for the Host and Port to the Container.

Configuration

Change the environment file .env

Edit the .env file to change it:

  • IP address
  • WordPress Host Port
  • WordPress Container Port
  • MySQL IP address
  • MySQL Root User
  • MySQL Root Password
  • MySQL Database Name
  • MySQL Host Port
  • MySQL Container Port
  • PMA Port
  • PMA Host Port
  • PMA Container Port

Installation

Open a terminal and cd to the folder in which docker-compose.yml is saved and run:

docker-compose up

The containers are now built and running. You should be able to access the WordPress installation with the configured IP in the browser address. By default it is http://127.0.0.1.

For convenience you may add a new entry into your hosts file.

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:

docker-compose start

Stopping containers

docker-compose stop

Removing containers

To stop and remove all the containers use thedown command:

docker-compose down

Use -v if you need to remove the database volume which is used to persist the database:

docker-compose down -v

Developing a Plugin

Configure the volume to load the plugin in the container in the docker-compose.yml:

volumes:
  - ./<path for the plugin>/:/var/www/html/wp-content/plugins/plugin-name

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

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors