Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse docker-compose labels #97

Open
bersace opened this issue Mar 28, 2017 · 2 comments
Open

Reuse docker-compose labels #97

bersace opened this issue Mar 28, 2017 · 2 comments

Comments

@bersace
Copy link

bersace commented Mar 28, 2017

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 !

@wclr
Copy link

wclr commented Jun 28, 2017

Why not use

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

@bersace
Copy link
Author

bersace commented Jun 28, 2017

@whitecolor COMPOSE_PROJECT_NAME is not always set while label is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants