Can I access Wordpress with http://localhost:9000

Hi all,

I have an issue with a docker-compose that builds a wordpress container. I have set up a mariadb database, and the wordpress successfully adds its files to the database.
However, I am trying to build a nginx container and am having problems. I don’t know if the problem is with wordpress or with my nginx config.
My question is: with only mariadb and wordpress installed, am I able to connect to wordpress with http://localhost:9000?

this is my docker compose:

services:
  mariadb:
    container_name: mariadb
    build: ./mariadb
    volumes:
      - mariadb_data:/var/lib/mysql
    env_file:
      - .env
    restart: on-failure
    networks:
      - inception

  wordpress:
    container_name: wordpress
    build: ./wordpress
    volumes:
      - wordpress_data:/var/www/html
    env_file:
      - .env
    restart: on-failure
    networks:
      - inception
    depends_on:
      - mariadb
volumes:
  mariadb_data:
  wordpress_data:

networks:
  inception:

this is my wordpress dockerfile:

FROM		debian:bullseye

EXPOSE		9000

RUN			apt-get update \
			&& apt-get install -y \
				php-fpm \
				php-mysql \
				wget \
				tar \
			&& apt-get clean \
			&& rm -rf /var/lib/apt/lists/*

RUN			mkdir -p /var/www/

RUN			wget -O /tmp/latest.tar.gz https://wordpress.org/latest.tar.gz \
			&& tar -xvf /tmp/latest.tar.gz -C /var/www/ \
			&& rm /tmp/latest.tar.gz

COPY		files/www.conf /etc/php/7.4/fpm/pool.d/www.conf
COPY		files/wp-config.php /var/www/wordpress/wp-config.php

COPY		files/setup.sh /tmp/
RUN			chmod +x /tmp/setup.sh

ENTRYPOINT ["/tmp/setup.sh", "php-fpm7.4", "-F", "-R"]

obs.: this is a school assignment, so I have to build containers from debian:bullseye

So far I read you’re downloading the php code (zip) from WordPress (why not Joomla, well better, wink) but you don’t have a web server like apache or nginx.

In your assigment you should then use a third container for the Web service.

For the fun, I’ve wrote this article months ago Quickly install Wordpress in just three commands | Christophe Avonture. Take a look on the image I’m using, it’s WordPress+Apache. In your case, you miss that.

2 Likes

Just to leave a short explanation for this here: PHP FPM is not a webserver, you can’t access it from a web browser.

1 Like