dnsdock icon indicating copy to clipboard operation
dnsdock copied to clipboard

Reuse docker-compose labels

Open bersace opened this issue 8 years ago • 2 comments

Hi,

In my use case, I avoid exposing ports and prefer .docker resolution to launch several instances of compose project. This require to export an env var and reuse it as region in dnsdock.

# .envrc
export COMPOSE_PROJECT_NAME=dev
version: '3'
services:
  app:
    labels:
      com.dnsdock.region: ${COMPOSE_PROJECT_NAME}
      com.dnsdock.name: app

What do you think of falling back label com.dnsdock.region to com.docker.compose.project and label com.dnsdock.name to com.docker.compose.service ?

This allow to resolve service as close as possible to compose structure :

$ getent hosts app.$COMPOSE_PROJECT_NAME.docker
172.23.0.4      app.compose.docker
$

Thanks for dnsdock, it's a lot easier than playing with ports !

bersace avatar Mar 28 '17 09:03 bersace

Why not use

com.dnsdock.alias: "app.${COMPOSE_PROJECT_NAME}.docker"

wclr avatar Jun 28 '17 10:06 wclr

@whitecolor COMPOSE_PROJECT_NAME is not always set while label is.

bersace avatar Jun 28 '17 11:06 bersace