Home > Software > How to Deploy Unraid Services with Docker Compose: An Example

How to Deploy Unraid Services with Docker Compose: An Example

Anastasios Antoniadis

Effortlessly deploy Unraid services using Docker Compose with our easy-to-follow guide. Learn how to harness the power of Docker Compose on your Unraid server to streamline the deployment of services and applications.

Docker (1)

Unraid, a powerful Linux-based operating system designed to meet the needs of home and small office users, combines network-attached storage (NAS) capabilities with media streaming, virtual machine hosting, and more. One of Unraid’s strengths lies in its Docker support, allowing users to deploy various applications as containers. Docker Compose, a tool for defining and running multi-container Docker applications, can significantly simplify the process of managing Docker containers on Unraid. This article provides a step-by-step guide to using Docker Compose on Unraid, including an example configuration.

Prerequisites

Before you start, ensure you have the following:

  • Unraid server up and running.
  • Docker service enabled on your Unraid server.
  • Community Applications plugin installed on Unraid for accessing Docker Compose.

Installing Docker Compose on Unraid

Unlike traditional Linux distributions, where Docker Compose can be installed directly through the package manager, on Unraid, It is typically managed through Docker containers themselves or through the NerdPack plugin for command-line utilities. The recommended approach is using a Docker container that includes Docker Compose, ensuring it doesn’t interfere with Unraid’s system packages.

  1. Community Applications Plugin: First, install the Community Applications plugin. This plugin allows you to easily find and install Docker containers and other applications on Unraid.
  2. Search for Docker Compose: Within the Community Applications, search for a Docker Compose container. An example is the linuxserver/docker-compose container, which is specifically packaged for use on Unraid and other Docker environments.
  3. Install the Container: Follow the instructions to install the Docker Compose container. This typically involves specifying paths and other configurations tailored to your Unraid setup.

Example Docker Compose Configuration

Once Docker Compose is installed, you can define your applications using a docker-compose.yml file. Below is a simple example that deploys a web server using the Nginx image.

Step 1: Create Docker Compose File

Create a new text file named docker-compose.yml in a directory on your Unraid server where you intend to manage your Docker Compose projects. Add the following content:

version: '3'
services:
  webserver:
    image: nginx:latest
    container_name: nginx_webserver
    ports:
      - "8080:80"
    volumes:
      - /mnt/user/appdata/nginx:/usr/share/nginx/html
    restart: unless-stopped

In this example, we define a single service called webserver that uses the latest Nginx image. We map port 8080 on the host to port 80 in the container, allowing you to access the web server through the host’s IP address on port 8080. The volumes section maps a directory from Unraid to the container, where you can place your website files. The restart: unless-stopped option ensures the container automatically restarts unless it has been explicitly stopped.

Step 2: Deploy Using Docker Compose

To deploy the service defined in your docker-compose.yml file, open a terminal session on your Unraid server and navigate to your file’s directory. Use the following command to start the services in detached mode:

docker compose up -d

This command reads the docker-compose.yml file in the current directory and starts the defined services. You can now access the Nginx web server by navigating to http://<Your-Unraid-IP>:8080 in a web browser.

Conclusion

Using Docker Compose on Unraid can streamline the deployment and management of Docker containers, making it easier to run complex applications with multiple services. By leveraging Unraid’s robust storage capabilities and Docker’s containerization technology, you can create a highly versatile server environment tailored to your needs. Whether you’re hosting web applications, media servers, or development environments, Docker Compose and Unraid provide a powerful and flexible platform.

Anastasios Antoniadis
Follow me
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x