Git Product home page Git Product logo

wordpress-docker-example's Introduction

🎨 WordPress Docker Example

Project Status: Active. Stars Forks Contributors Follow

  • WordPress Setup with Docker.
  • mysql
  • phpMyAdmin

Setup

Run this from root

docker-compose -f docker-compose.yml up -d 

WordPress will be available on http://localhost:8020

phpMyAdmin: You can access php myadmin on http://localhost:8183

port: mysql:3306
username: root
password: root

phpmyadmin docker image already comes with the username root and we have set the mysql password in the dockerfile

  • If you happen to use your own WordPress setup, be sure to install and activate plugins from composer.json and add your own WordPress site URL in an .env file, You can check the .env-example file for reference.

Development ( Developers only )

  1. When we change the composer.json, run from root
docker-compose -f docker-compose.yml down && \
docker-compose -f docker-compose.yml up -d 

First line command will stops and removes all the docker containers and second line command will restart all containers. Notice that -d is to run in detach mode and you can always remove that flag, and run the command so you can see the live logs. Or you can check the logs for

  1. Check the logs While the above command is running in detached mode ( -d ), you can run this command in a new terminal tab to see the live logs.
docker logs -f container-name

e.g.

docker container ls

result

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                  NAMES
d0b4a3b0074f        wordpress:latest    "docker-entrypoint.s…"   About a minute ago   Up About a minute   0.0.0.0:8000->80/tcp   backend_wordpress_1
aad078ebe131        mysql:5.7           "docker-entrypoint.s…"   About a minute ago   Up About a minute   3306/tcp, 33060/tcp    backend_db_1

Here container-name is backend_db_1 or backend_wordpress_1

  1. If you make changes to docker-compose.yml file, run the following:

If you happend to change the port in docker-compose.yml make sure to delete the db directory and then run below.

docker-compose -f docker-compose.yml down && \
docker-compose -f docker-compose.yml up -d

Debugging

  1. If you get 404 on requests, check to see that the .htaccess file in wordpress directory has the rules
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

References for Docker Images.

  1. phpMyAdmin

wordpress-docker-example's People

Contributors

imranhsayed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.