Docker - Linux Docker Compose Wrapper

Docker Compose Wrapper (dc)

A small wrapper around docker compose that automatically loads shared environment files for all stacks.

Why

Docker Compose only interpolates ${VARIABLES} from:

It does not use the env_file: directive for interpolation.
This wrapper always passes the shared files so every stack gets consistent variable substitution.

Shared Files

/mnt/volume1/docker/stacks/_shared/.env
/mnt/volume1/docker/stacks/_shared/.secret

Install

  1. Create the wrapper:
Bash

sudo tee /usr/local/bin/dc > /dev/null << 'EOF'
#!/bin/bash
exec docker compose \
  --env-file /mnt/volume1/docker/stacks/_shared/.env \
  --env-file /mnt/volume1/docker/stacks/_shared/.secret \
  "$@"
EOF
  1. Make it executable:
Bash

sudo chmod +x /usr/local/bin/dc
  1. Verify:
Bash

which dc
dc version

Usage

Use dc exactly like docker compose.
All subcommands work.

Bash

dc up -d
dc logs
dc logs -f
dc ps
dc restart <service>
dc down
dc config

Notes

Bash

dc config

Updating

Edit the script if the shared file paths change:

Bash

sudo nano /usr/local/bin/dc

Revision #1
Created 12 October 2026 15:49:36 by Admin
Updated 12 October 2026 15:58:06 by Admin