Wordpress http://localhost:8000 or http://localhost:80 is not working

Hi

I am new to docker, trying to install wordpress details are

OS : Windows 10 Home
Docker Version : Docker version 19.03.1, build 74b1e89e8a
docker-compose version 1.24.1, build 4667896b

my file docker-compose.yml is

version: '3.3'
  services:
  db:
    image: mysql:5.7
  volumes:
    - db_data:/var/lib/mysql
  restart: always
  environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: mysql
    MYSQL_USER: admin
    MYSQL_PASSWORD: admin
  wordpress:
    depends_on:
      - db
  image: wordpress:latest
  ports:
    - "8000:80"
  restart: always
  environment:
    WORDPRESS_DB_HOST: db:3306
    WORDPRESS_DB_USER: admin
    WORDPRESS_DB_PASSWORD: admin
    WORDPRESS_DB_NAME: admin
  volume:
    db_data: {}
it is working fine with
    
    docker-compose up -d 

docker ps

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
944e0ea8ff69        wordpress:latest    "docker-entrypoint.s…"   56 minutes ago      Up 56 minutes       0.0.0.0:8000->80/tcp   wordpress_wordpress_1
5a3890fed7fe        redis               "docker-entrypoint.s…"   About an hour ago   Up About an hour    6379/tcp               sleepy_matsumoto
4edf3f9fc944        mysql:5.7           "docker-entrypoint.s…"   2 hours ago         Up 59 minutes       3306/tcp, 33060/tcp    wordpress_db_1

But when I am running http://localhost:8000 or http://localhost:80 in browser it is showing site is not reachable. Can you help me to resolve this issue urgently ?

Thanks

i did try it:

$ sudo podman-compose  up
...
MySQL Connection Error: (2002) Connection refused
...
MySQL "CREATE DATABASE" Error: Access denied for user 'admin'@'%' to database 'admin'

WARNING: unable to establish a database connection to 'db:3306'
  continuing anyways (which might have unexpected results)

Yes, I’m working on fedora actually…
So, something seems to be wrong with the compose file settings. Is it copy&paste from docker-hub?

FYI wordpress and mysqk container running without any issue, it is not from dockerhub but it is from https://www.hostinger.in/tutorials/run-docker-wordpress

are you aware that you changed from original article db-name and user/passwords? They must match each other!

Hello, i have a similar problem.

OS: Windows 7 (I tried in Fedora 30 too)
Docker Version: 1.20.1
Docker-compose version 1.20.1

my file docker-compose.yml is

version: ‘3.1’

services:

wordpress:
links:
- db
image: wordpress
restart: always
ports:
- 8081
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- wordpress:/var/www/html

db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: ‘1’
volumes:
- db:/var/lib/mysql

volumes:
wordpress:
db:


When i try:
$ docker-compose -f stack.yml up

I have this errors:

db_1 | Version: ‘5.7.30’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 MySQL Community Server (GPL)
wordpress_1 | [25-May-2020 05:25:46 UTC] PHP Warning: mysqli::__construct(): (HY000/1045): Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES) in Standard input code on line 22
db_1 | 2020-05-25T05:25:46.989625Z 2 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
db_1 | 2020-05-25T05:25:49.994447Z 3 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
db_1 | 2020-05-25T05:25:52.999923Z 4 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
db_1 | 2020-05-25T05:25:56.005195Z 5 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
db_1 | 2020-05-25T05:25:59.011116Z 6 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
db_1 | 2020-05-25T05:26:02.014544Z 7 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
db_1 | 2020-05-25T05:26:05.018978Z 8 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
db_1 | 2020-05-25T05:26:08.031773Z 9 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
db_1 | 2020-05-25T05:26:11.050647Z 10 [Note] Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | MySQL Connection Error: (1045) Access denied for user ‘exampleuser’@‘172.18.0.3’ (using password: YES)
wordpress_1 |
wordpress_1 | WARNING: unable to establish a database connection to ‘db’
wordpress_1 | continuing anyways (which might have unexpected results)
wordpress_1 |
wordpress_1 | AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 172.18.0.3. Set the ‘ServerName’ directive globally to suppress this message
wordpress_1 | AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 172.18.0.3. Set the ‘ServerName’ directive globally to suppress this message
wordpress_1 | [Mon May 25 05:26:14.414460 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.3.18 configured – resuming normal operations

Hi

I got an answer for this problem details are as under as I have installed docker using Docker Toolbox

$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           v19.03.5

Now if I do

http://192.168.99.100:8000/

Now finally it is working. Hopefully it will help you too