jbfink / docker-wordpress

Dockerfile and etc for a Wordpress docker image
The Unlicense
276 stars 120 forks source link

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

Open natea opened 11 years ago

natea commented 11 years ago

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

jbfink commented 11 years ago

Hey @natea, somehow I totally missed you posting this. Yeah, I have wrestled with the (imho) totally dumb requirement Wordpress has to hardcode a URL/port and I'm still not exactly sure how to do it. Something in the script to wait for input and ask for a URL maybe? What do you think?

lautreamont3 commented 10 years ago

Not an expert but I think that WP stores in database what you send to him (if it has a port number he stores port number) so if you in command line specify port (-p 80:80) then container get new IP adress (0.0.0.0). Just add to your /etc/hosts something like: 0.0.0.0 my_wp_site.dev and you can reach WP with http://my_wp_site.dev and that goes to database.

jbfink commented 10 years ago

Wouldn't adding 0.0.0.0 in /etc/hosts cause problems? It's the broadcast address, so I'd think there'd be a danger of having everything redirect to my_wp_site.dev?

lautreamont3 commented 10 years ago

I was just pointing simple way for addressing problem. Give container fixed address and give fixed address simbolic name. Since 6.5 its posible to set port -p 127.0.0.1:80:80 so you could add 127.0.0.1 my_wp_site.dev to /etc/hosts or just use localhost.