Anders Kitson
Anders Kitson

Reputation: 1545

Getting wordpress docker to run on local host

I have followed this github and I my localhost port 80 is not showing anything

https://github.com/eugeneware/docker-wordpress-nginx

this is the terminal output

Successfully built f4843e2f3e47
bash-3.2$ docker run -p 80:80 --name docker-wordpress-nginx -d docker-wordpress-nginx
08665dbffdbbf7678b57d62766f367f503e2f9444e11ea86ea2bb6aa932127fd
bash-3.2$ docker start docker-wordpress-nginx
docker-wordpress-nginx
bash-3.2$ docker ps
CONTAINER ID        IMAGE                           COMMAND                CREATED             STATUS              PORTS                          NAMES
08665dbffdbb        docker-wordpress-nginx:latest   "/bin/bash /start.sh   18 seconds ago      Up 17 seconds       3306/tcp, 0.0.0.0:80->80/tcp   docker-wordpress-nginx   
bash-3.2$ docker ps
CONTAINER ID        IMAGE                           COMMAND                CREATED             STATUS              PORTS                          NAMES
08665dbffdbb        docker-wordpress-nginx:latest   "/bin/bash /start.sh   50 seconds ago      Up 49 seconds       3306/tcp, 0.0.0.0:80->80/tcp   docker-wordpress-nginx   
bash-3.2$ 

Upvotes: 0

Views: 554

Answers (1)

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91617

The exact behavior here depends a bit on your docker version, though with the newer versions (1.2+) wordpress, when running in the container, needs to be configured to listen to connections from any address rather then 127.0.0.1 or ::1. You can check if this is your problem by running

netstat -nlp | grep 80

from within the container and see if the output is something like:

tcp6       0      0 :::80                   :::*                    LISTEN      - 

then it's correct. If instead it's like: (this example is from a mysql container)

tcp        0      0 127.0.0.1:3306            0.0.0.0:*               LISTEN      -

Then no other container or host will be able to connect to it.

Upvotes: 1

Related Questions