How to Build a Docker Stack with Both Release and Develop Versions

I had this question in the Telegram group, and with the help of the community, I was able to find a solution. I’m posting it here so others can also benefit from it.

This guide explains how to set up a Docker Compose stack that allows you to run both the release and develop versions of an application in a single stack file. The setup includes two services, each with a different image and IP address, but sharing the same network and volume configurations.

Docker Compose Configuration

version: '3.8'

services:
  teddycloud:
    container_name: teddycloud
    hostname: teddycloud
    restart: unless-stopped
    image: ghcr.io/toniebox-reverse-engineering/teddycloud:tc_v0.5.2_alpine
    networks:
      tc1_macvlan:
        ipv4_address: 192.168.178.210
    dns:
      - 192.168.178.1
    volumes:
      - /path/to/certs:/teddycloud/certs
      - /path/to/config:/teddycloud/config
      - /path/to/content:/teddycloud/data/content
      - /path/to/library:/teddycloud/data/library
      - /path/to/firmware:/teddycloud/data/firmware

  teddycloud_develop:
    container_name: teddycloud_develop
    hostname: teddycloud_develop
    restart: unless-stopped
    image: ghcr.io/toniebox-reverse-engineering/teddycloud:develop_alpine
    networks:
      tc1_macvlan:
        ipv4_address: 192.168.178.211
    dns:
      - 192.168.178.1
    volumes:
      - /path/to/certs:/teddycloud/certs
      - /path/to/config:/teddycloud/config
      - /path/to/content:/teddycloud/data/content
      - /path/to/library:/teddycloud/data/library
      - /path/to/firmware:/teddycloud/data/firmware

networks:
  tc1_macvlan:
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: 192.168.178.0/24
          gateway: 192.168.178.1

By following this setup, you can easily run both the release and develop versions side by side in your Docker environment.

Router Configuration (e.g., Fritzbox)

To make sure the services are accessible under the correct names, you need to configure your router (e.g., Fritzbox) to associate the hostname tc with the appropriate IP address. Depending on which version you want to use:

  • For the release version: Set the hostname tc to point to the IP address 192.168.178.210.
  • For the develop version: Set the hostname tc to point to the IP address 192.168.178.211.

This configuration ensures that when you access tc on your network, it will route to the correct version of your application.

2 Likes