Skip to content

Afrozaar/docker-wordpress

Repository files navigation

Afrozaar Notes

This clone is adapted to add the capabilities that comes with wp-cli to set up the wordpress installation and configure rewrite URL, custom plugins and much more.

Running ./build.sh will build 2 images (just for efficiency network-intensive package installs run in the separate base image) setting up plugins and doing configuration. Lastly, an entry will be added to /etc/hosts to make the container available at http://docker.dev.

Starting Up

After running ./build.sh, do:

docker run -d --name wp_build_test -p 80:80 afrozaar/wordpress:latest

Then open up http://docker.dev in your browser.

username: docker
password: docker!

Running on a non-standard port

More likely than not, it is desireable to run on a non-standard port, if for example, you want to run multiple wordpress sites each in its own container.

To achieve this, the following recipe works its magic by creating a new container mapping it to a specific port, and updating the wordpress configuration with the intended port.

  • Create container mapping to a particular port:
docker run -d --name wp_p_5000 -p 5000:80 afrozaar/wordpress
  • Update the configuration to point to the port configuration:
docker exec -it wp_p_5000 wp --path='/var/www' --allow-root option update siteurl "http://docker.dev:5000"
docker exec -it wp_p_5000 wp --path='/var/www' --allow-root option update home "http://docker.dev:5000"

Original README:

(note: docker-wordpress no longer contains an sshd. It was probably a mistake to put one in in the first place, and you can now spawn arbitrary processes with use of the docker exec command. So do that, instead, like this:

docker exec -i -t docker-wordpress bash

easy!)

(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 -d -p <http_port>:80 <yourname>/wordpress

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.

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!

About

Clone of https://github.com/jbfink/docker-wordpress.git with modifications to add wp-cli capabilities.

Resources

License

Unlicense, Unlicense licenses found

Licenses found

Unlicense
LICENSE.txt
Unlicense
UNLICENSE.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published