Posted On April 2, 2024

How To Link Containers Using Docker Compose

kimconnect 0 comments
blog.KimConnect.com >> Codes , Database , Virtualization >> How To Link Containers Using Docker Compose

This yields several advantages:
1. Direct linking between containers is architectually efficient to direct traffic between endpoints. That is because containers within the same “project” can communicate without relying on switching or routing of the virtual network.

2. Not having to expose certain services/ports from back-end servers should improve the security posture of the overall design.

Here’s an example:

---
services:
  nextcloud:
    image: lscr.io/linuxserver/nextcloud:latest
    container_name: kimconnect-nextcloud
    environment:
      - TZ=America/Los_Angeles
    volumes:
      - /volume1/docker/kimconnect/config:/config
      - /volume1/docker/kimconnect/data:/data
#    network_mode: "bridge"
    depends_on:
      - postgresql
    ports:
      - 4443:443
#      - 3478:3478
#      - 3478:3478/udp
    restart: unless-stopped
    links:
    - postgresql
  postgresql:
    image: bitnami/postgresql:latest
    container_name: kimconnect-postgresql
    environment:
      - TZ=America/Los_Angeles
      - POSTGRESQL_USERNAME=SOMETHINGHERE
      - POSTGRESQL_PASSWORD=SOMEPASSWORDHERE
    volumes:
      - /volume1/docker/kimconnect/postgresql:/bitnami/postgresql
#    network_mode: "bridge"
#    ports:
#      - 55432:5432
    restart: unless-stopped

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Microsoft SQL Cloning Database to a Different DB Name

# User defined variables $sourceSqlServer='DEV-SQL01' $sourceDatabaseName='TEST_MSCRM' $sourceSaCredential=$(get-credential) $destinationSqlServer='DEV-SQL01' $destinationDatabaseName='Test_MSCRM' $destinationSaCredential=$(get-credential) function copyDatabase{ param( $sourceSqlServer, $sourceDatabaseName,…

VMware: How To Mount a USB Thumb Drive as a Data Store

Although USB is not a recommended data store type, it is still possible to mount…

Add a Domain Group to Local Administrators Group

$checkGroup="Administrators" $addMember="KIMCONNECT\Desktop Admins" # Dynamic Credential $who = whoami if ($who.substring($who.length-2, 2) -eq "-admin"){$username=$who;} else…