Install phpBB Inside Docker Container in Linux

Install phpBB Inside Docker Container in Linux

The phpBB is a web-based forum application that written in the PHP programming language. The phpBB is an open-source software that released under the GNU General Public License.

This tutorial explains how to install phpBB inside a Docker container in the Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

You also need to have a running MySQL container. Instructions can be found in the post.

Install phpBB

Before starting, create phpbb database:

docker exec -it mysql mysql -u root -p -e "CREATE DATABASE phpbb"
  • Host network

Run the following command to create a container for phpBB that uses host network:

docker run -d --name=phpbb --restart=always --network=host \
    -v /opt/phpbb/data:/bitnami/phpbb \
    -e PHPBB_USERNAME=admin \
    -e PHPBB_PASSWORD=pwd123 \
    -e PHPBB_DATABASE_USER=root \
    -e PHPBB_DATABASE_PASSWORD=pwd123 \
    -e PHPBB_DATABASE_NAME=phpbb \
    -e PHPBB_DATABASE_HOST=127.0.0.1 \
    bitnami/phpbb

MySQL container should run on host network as well.

  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, phpBB service is listening on port 8080. It can be changed with -p option.

docker network create app-net
docker run -d --name=phpbb --restart=always --network=app-net \
    -p 8081:8080 \
    -v /opt/phpbb/data:/bitnami/phpbb \
    -e PHPBB_USERNAME=admin \
    -e PHPBB_PASSWORD=pwd123 \
    -e PHPBB_DATABASE_USER=root \
    -e PHPBB_DATABASE_PASSWORD=pwd123 \
    -e PHPBB_DATABASE_NAME=phpbb \
    -e PHPBB_DATABASE_HOST=mysql \
    bitnami/phpbb

MySQL container should run on the same user-defined bridge network as well.

Notes:

  • Don't forget to change admin password for phpBB using PHPBB_PASSWORD.
  • The PHPBB_DATABASE_USER and PHPBB_DATABASE_PASSWORD can be used to specify MySQL credentials.
  • When user-defined bridge network is used, don't forget to change PHPBB_DATABASE_HOST. It specifies MySQL container name.

Testing phpBB

Open a web browser and go to http://<IP_ADDRESS>:8080, where <IP_ADDRESS> is the IP address of the system. Log in to the admin control panel (ACP) with the admin username and password.

phpBB Inside Docker Container in Linux

Uninstall phpBB

To completely remove phpBB, remove its container:

docker rm --force phpbb

Remove phpBB image:

docker rmi bitnami/phpbb

You can also remove phpBB data:

sudo rm -rf /opt/phpbb

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.