Git Product home page Git Product logo

docker-wordpress's Introduction

(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!

docker-wordpress's People

Contributors

dkinzer avatar elsonrodriguez avatar jbfink avatar jkerihuel 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-wordpress's Issues

Wordpress doesn't work on a SLES-12 host using SLES base image

Hi John,

I have used your existing dockerfile and edited it for the dependencies which i could find on SLES using zypper and some i built from source using reliable source codes ,for eg ; pwgen , apache2.
I haven't changed anything else in your script files.

I am able to build a docker image , but strangely i face below issues while running the same.

  1. When i run my image as below : docker run --name -d -p 8080:80 , this container remains active for maximum 20 seconds and it exits. To avoid it from exiting i ran it again as : docker run --name -d -t -p 8080:80 so that the container remains active , but when i try to open this url on my browser , i am getting the page with error as : "Unable to load the webpage because the server sent no data."
    No Data received ERR_EMPTY_RESPONSE.

Any pointer to resolve this issue ?

Regards,
Amit

UserWarning: Supervisord is running as root

I get the following messing when looking up password and then when ssh in it logs in but immediately states that connection closed.

echo $(sudo docker logs suspicious_sinoussi | grep password)

140424 21:07:15 mysqld_safe Can't log to error log and syslog at the same time. 
Remove all --log-error configuration options for --syslog to take effect. /usr/local/lib/python2.7/dist-packages/supervisor-3.0py2.7.egg/supervisor/options.py:295: UserWarning: 
Supervisord is running as root and it is searching for its configuration file in default 
locations (including its current working directory); you probably want to specify a "-c" 
argument specifying an absolute path to a configuration file for improved security. 
'Supervisord is running as root and it is searching ' 
ssh user password: poc5Da2M mysql root password: Sho3aiwei5ie wordpress password: aiThij7heesu

Sudo doesn't work

on OSX using boot2docker After

ssh -p <port> user@localhost 

succeeds I can't sudo:
Error:

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

can't find good fix and wish to edit /var/www/ php files

Wordpress admin password being overwritten during install

Hello, I may have the wrong end of the stick here, but when this image finishes its start.sh script and you visit the website, you are taken through the WP install process. This overwrite the wp-admin password - is that correct?

apache 404 error

I builded and start container.
It llooks good

root@ubuntu-14:# docker logs 5a478de05149
ssh user password: phaiHoo8
140603 11:19:43 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect.
140603 11:19:43 mysqld_safe Logging to '/var/log/mysql/error.log'.
140603 11:19:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql root password: fa6ahs3Ohs8t
wordpress password: Xah9Pae3thu8
140603 11:19:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
/usr/local/lib/python2.7/dist-packages/supervisor-3.0-py2.7.egg/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
2014-06-03 11:20:03,597 CRIT Supervisor running as root (no user in config file)
2014-06-03 11:20:03,621 INFO RPC interface 'supervisor' initialized
2014-06-03 11:20:03,622 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2014-06-03 11:20:03,622 INFO supervisord started with pid 406
2014-06-03 11:20:04,627 INFO spawned: 'httpd' with pid 409
2014-06-03 11:20:04,633 INFO spawned: 'sshd' with pid 410
2014-06-03 11:20:04,642 INFO spawned: 'mysqld' with pid 411
2014-06-03 11:20:06,414 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2014-06-03 11:20:06,415 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2014-06-03 11:20:06,418 INFO success: mysqld entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
root@ubuntu-14:
#

But If I open site in browser I get
Not Found

The requested URL / was not found on this server.

Apache/2.4.7 (Ubuntu) Server at 192.168.1.31 Port 90

I loged into docker container via ssh (supervisor is awesome!)
And found that

$ cat 000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

Vhost point to unexisting document root (/var/www/html)

Make backup and restore from backup

It would be greate to have opportunity to make backup (db and files) and to restore your wordpress site from such backup.
For example, It helps If you decide to move to another server.

Specify URL rather than auto-populated the Wordpress address and Site address

It would be nice if the site URL could be specified during creation, rather than auto-populated. You can see that it's included the port 49166, but I want it to answer on port 80. Until I removed the :49166 in the Wordpress admin, it was forwarding the requests from port 80 to port 49166, and this is what was showing up in the URL bar in my browser.

wordpress-site-with-port

Error establishing a database connection

When I try to launch a container using the jbfink/wordpress image, when I try to go to the URL, I see the error 'Error establishing a database connection'. Below is what's in the logs. Could it be that the 10s wait time is not sufficient? https://github.com/jbfink/docker-wordpress/blob/master/start.sh#L12

ssh user password: aikoo0Fa 
131006 15:58:28 mysqld_safe Logging to syslog. 
131006 15:58:30 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
mysql root password: eCheeth0peik 
wordpress password: zah3eep3AKee 
�mysqladmin: connect to server at 'localhost' failed 
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' 
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists! 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 
131006 15:58:42 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 
/usr/local/lib/python2.7/dist-packages/supervisor-3.0-py2.7.egg/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. 
'Supervisord is running as root and it is searching ' 
2013-10-06 15:59:25,866 CRIT Supervisor running as root (no user in config file) 
2013-10-06 15:59:26,007 INFO RPC interface 'supervisor' initialized 
2013-10-06 15:59:26,008 CRIT Server 'unix_http_server' running without any HTTP authentication checking 
2013-10-06 15:59:26,008 INFO supervisord started with pid 357 
2013-10-06 15:59:27,016 INFO spawned: 'httpd' with pid 360 
2013-10-06 15:59:27,032 INFO spawned: 'sshd' with pid 361 
2013-10-06 15:59:27,055 INFO spawned: 'mysqld' with pid 362 
2013-10-06 15:59:28,070 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 
2013-10-06 15:59:28,096 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 
2013-10-06 15:59:28,096 INFO success: mysqld entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

mysqld.sock missing

Hey,

I'm confused as it appears the the mysql.sock is missing. Here is what I do:

sudo docker build -t wordpress .
sudo docker run -v /srv/wwww/myproject/wordpress/:/var/www/ -d -p 80:80 wordpress

All boots ok, but then when I access the site, I get the famous Error establishing a database connection. So I decided to investigate by running this:

sudo docker run -v /srv/wwww/myproject/wordpress/:/var/www/ -i -t wordpress /bin/bash
mysql -uroot -p

I get: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Ok, so now, I run mysqld_safe & sleep 10s. All good, I can mysql -uroot -p, the /var/run/mysqld/mysqld.sock was created.

What confuses me is that after getting this mysqld.sock, I commited the change to the image. But then the sudo docker run -v /srv/wwww/myproject/wordpress/:/var/www/ -d wordpress /bin/bash /start.sh leads again to mysql connection error.

I've tried many things before asking but I'm totally confused by this behaviour. Thanks!

port 80 not working for me

This is my first docker container so I'm probably doing something wrong:

The process is running:
docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
885609d82b0a joe/wordpress:latest /bin/bash /start.sh 6 minutes ago Up 6 minutes 49154->80

but if I try to connect I get "connection refused"

I also try docker attach 885609d82b0a but it just hangs.

I can connect using the other port:
i.e. lynx localhost:49154 works and brings me to the WP install page.

what do I need to do to make it work on port 80? and how can i open a shell onto that contatiner (attach?)?

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.