Docker Community Forums

Share and learn in the Docker community.

How to get a permanent container DNS endpoint (Autoredeploy)

build
docker

(Johanneshoppe) #1

Hello,

I’m trying out a simple container with “Autoredeploy” (from github).
As described in the docs container endpoints as well as service endpoints are created in the following format:

container-name[.stack-name].shortuuid.cont.dockerapp.io
service-name[.stack-name].shortuuid.svc.dockerapp.io

A port is published and I can use the URLS, which are shown in the “Endpoints” section.

PROBLEM: On every automated redeploy both shortuuids are changing.

So the publically available URL is changing on every github push. How I’m supposed to point a permanent CNAME entry to this always-changing DNS endpoints?!

Right now I have a CNAME like this

CNAME test container-name.0ee1ee06.cont.dockerapp.io

… and it’s already broken again! ?

Thanks
Johannes


(Peterlauri) #2

I don’t know if it might help you, but you will get more stable endpoints if you would put your services behind HAproxy. That endpoint doesn’t change on redeploys of linked services, so it should be kept fixed. However, I don’t know if something else happens if you build it using a stack. I haven’t gotten there yet in my playful experiment :slight_smile:


(Johanneshoppe) #3

Thanks for the fast reply. I wanted to keep it simple. Yet another container (HAproxy) just for the sake of a stable DNS seems to be bit over-engineered… :frowning:


(Peterlauri) #4

Are you deployed on AWS? Then you can create fixed DNS mappings to your instances. And if you are on multiple instances (based on your concern I don’t think you are), you can put a AWS Load Balancer on it.

If you are not on AWS, look in your providers records, you will probably have a hostname assigned for the instances.


(Johanneshoppe) #5

Hi, that’s a good idea! :slight_smile: I’m on azure. But it’s the same here, too. All resources have a predictable and stable hostname. I’m wondering if this is the supposed way to go? This “workaround” only works, if the container is always deployed to the exact same node.

I wish there would be a second DNS entry without the shortuuid!?


(Peterlauri) #6

If you one have one container you can tag it in Docker Cloud and associate that service with that tag. Then you will be guaranteed that it is deployed on the same instance all the time.


(Peterlauri) #7

I mean tag the instance, and associate the service with that tag.


(Geoff Bowers) #8

The container endpoints change every time as you are creating new containers. The service end point should remain the same regardless of the number of redeploys.

Initial endpoints

Redeployed endpoints

Note, these examples reference a service haproxy defined in a stack called utilities.

It would be most unusual to CNAME the container endpoint as per your example.

Hope that helps!


(Johanneshoppe) #9

Indeed. You are right - only the container endpoint changes.
Many thanks for pointing this out! :sweat_smile:


(Johanneshoppe) #10

after redeploy: