Can't see staring installation page of wordpress docker container based on alpine linux

719 views Asked by At

Here is my configuration :

OS : Windows 10 Enterprise x64 [Version 10.0.14393]

Docker Toolbox: Docker version 1.12.5, build 7392c3b docker-compose version 1.9.0, build 2585387

My docker-compose.yml:

version: '2'

services:

  wordpress:
    image: wordpress:4.7.0-php7.0-fpm-alpine
    links:
      - "mysql:mysql-database"
    ports:
      - 8080:80
      - 9000:9000
    expose:
      - "3306"
      - "8080"
      - "80"

    environment:
      WORDPRESS_DB_PASSWORD: example


  mysql:
    image: mysql
    ports:
      - 3306:3306
    expose:
      - "3306"
    environment:
      MYSQL_ROOT_PASSWORD: example

Starting up this with : docker-compose up -d

After this don't see wordpress installation page on http://192.168.99.100:8080/

If I change wordpress tag to 4.7.0-php7.0-apache then everything works fine .Is there bug in alpine wordpress image or I just need to open some ports?

1

There are 1 answers

2
Thiago Almeida On

this alpine image was made with just php-fpm and need to be used alongside with an webserver like nginx.

There is my approach:

In the docker-compose.yml

version: '2'

services:
  web:
    image: nginx:latest
    ports:
      - 8080:80
    volumes:
      - ./site.conf:/etc/nginx/conf.d/default.conf:ro
      - /etc/localtime:/etc/localtime:ro
    volumes_from:
      - wordpress
  wordpress:
    image: wordpress:4.7.0-php7.0-fpm-alpine
    environment:
      WORDPRESS_DB_PASSWORD: example
      WORDPRESS_DB_HOST: mysql
  mysql:
    image: mysql
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_DATABASE: wordpress

And the site.conf:

server {
    listen 80;
    index index.php index.html;
    server_name $hostname;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /var/www/html;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass wordpress:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}