Code Monkey home page Code Monkey logo

wp-docker-neuralegion's Introduction

Configuration

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

Installation

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

docker-compose up

This creates two new folders next to your docker-compose.yml file.

  • wp-data – used to store and restore database dumps
  • wp-app – the location of your WordPress application

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

Project from existing source

Copy the docker-compose.yml file into a new directory. In the directory you create two folders:

  • wp-data – here you add the database dump
  • wp-app – here you copy your existing WordPress code

You can now use the up command:

docker-compose up

This will create the containers and populate the database with the given dump. You may set your host entry and change it in the database, or you simply overwrite it in wp-config.php by adding:

define('WP_HOME','http://wp-app.local');
define('WP_SITEURL','http://wp-app.local');

Creating database dumps

./export.sh

Developing a Theme

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

volumes:
  - ./theme-name/trunk/:/var/www/html/wp-content/themes/theme-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.

wp-docker-neuralegion's People

Contributors

ismarkunc avatar

Watchers

James Cloos avatar  avatar

wp-docker-neuralegion's Issues

Nice work!

Thank you for quick and accurate solution. I see, that you really know both Docker and WP!

Could you change the config, so that WP has a blog post with caption "Neuralegion Blog Post"?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.