Install Redmine Inside Docker Container in Linux

Install Redmine Inside Docker Container in Linux

Redmine is a web-based project management system that written using the Ruby on Rails framework. Redmine is an open-source project released under the GPLv2 license.

This tutorial explains how to install Redmine 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 Redmine

Before starting, create redmine database:

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

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

docker run -d --name=redmine --restart=always --network=host \
    -v /opt/redmine/data:/usr/src/redmine/files \
    -e REDMINE_DB_USERNAME=root \
    -e REDMINE_DB_PASSWORD=pwd123 \
    -e REDMINE_DB_DATABASE=redmine \
    -e REDMINE_DB_MYSQL=127.0.0.1 \
    redmine

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, Redmine service is listening on port 3000. It can be changed with -p option.

docker network create app-net
docker run -d --name=redmine --restart=always --network=app-net \
    -p 8080:3000 \
    -v /opt/redmine/data:/usr/src/redmine/files \
    -e REDMINE_DB_USERNAME=root \
    -e REDMINE_DB_PASSWORD=pwd123 \
    -e REDMINE_DB_DATABASE=redmine \
    -e REDMINE_DB_MYSQL=mysql \
    redmine

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

Notes:

  • The REDMINE_DB_USERNAME and REDMINE_DB_PASSWORD can be used to specify MySQL credentials.
  • When user-defined bridge network is used, don't forget to change REDMINE_DB_MYSQL. It specifies MySQL container name.

Testing Redmine

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

Redmine Inside Docker Container in Linux

Uninstall Redmine

To completely remove Redmine, remove its container:

docker rm --force redmine

Remove Redmine image:

docker rmi redmine

You can also remove Redmine data:

sudo rm -rf /opt/redmine

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.