Giter Site home page Giter Site logo

docker-wordpress's Introduction

(note: Eugene Ware has a Docker wordpress container build on nginx with some other goodies; you can check out his work here.)

(N.B. the way that Docker handles permissions may vary depending on your current Docker version. If you're getting errors like

dial unix /var/run/docker.sock: permission denied

when you run the below commands, simply use sudo. This is a known issue.)

This repo contains a recipe for making a Docker container for Wordpress, using Linux, Apache and MySQL. To build, make sure you have Docker installed, clone this repo somewhere, and then run:

docker build -rm -t <yourname>/wordpress .

Or, alternately, build DIRECTLY from the github repo like some sort of AMAZING FUTURO JULES-VERNESQUE SEA EXPLORER:

docker build -rm -t <yourname>/wordpress git://github.com/jbfink/docker-wordpress.git

Then run it, specifying your desired ports! Woo!

docker run --name wordpress -v <host wp-content>:/var/www/wp-content -e WP_DBNAME=<db name> -d -p <http_port>:80 -p <ssh_port>:22 <yourname>/wordpress 

Create in your wp-content a folder named "dump". In this folder put your mysql dump in to file named dump.sql. When container startup, the dump is loaded in to mysql wordpress db. Before container is shoutted down, is update a dump.sql file with last modify.

The db name env var is used for name of db and added to suffix table name in your wp-config.php

'wp_$DB_NAME'

Check docker logs after running to see MySQL root password and Wordpress MySQL password, as so

echo $(docker logs wordpress | grep password)

(note: you won't need the mysql root or the wordpress db password normally)

Your wordpress container should now be live, open a web browser and go to http://localhost:<http_port>, then fill out the form. No need to mess with wp-config.php, it's been auto-generated with proper values.

Note that this image now has a user account (appropriately named "user") and passwordless sudo for that user account. The password is generated upon startup; check logs for "ssh user password", and something like this to get in:

ssh -p <ssh_port> user@localhost

You can shutdown your wordpress container like this:

docker stop wordpress

And start it back up like this:

docker start wordpress

Enjoy your wordpress install courtesy of Docker!

docker-wordpress's People

Contributors

dkinzer avatar elsonrodriguez avatar jbfink avatar

Watchers

 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.