Reuse docker-compose labels
bersace opened this issue · 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 !
Why not use
com.dnsdock.alias: "app.${COMPOSE_PROJECT_NAME}.docker"
@whitecolor COMPOSE_PROJECT_NAME
is not always set while label is.