Adding many Labels to Docker Containers quickly/efficently


hpka

Recommended Posts

Hi,

 

I'm setting up Traefik (which I became used to running Ubuntu Server), but the question is more generic than that. I need to add ~5 Labels to many docker containers. Previously, when I was using Docker Compose to orchestrate things, this was a simple but attention-requiring Copy & Paste and replace the relevant bits. Through the UI I'm finding it more time consuming (although not impossible). I was wondering if there was a method or approach to speed up the task, at least as much as it can be.

 

Thanks

 

EDIT: Ok this really wasn't that bad in the end. A text editor with what I had to copy and paste speeded things up a lot and you can use Traefik with as little as 3 Labels. Also, contrary to my earlier confusion, I mean Labels, not Environment Variables.

Edited by hpka
Added retrospective.
Link to comment
  • 10 months later...

I am trying to also set up traefik and not grasbing labels yet in unRaid 

HEre is an example of labels I want to use in unraid 

 

# the basic labels to enable traefik to forward requests.somedns.com on port 443 to the ombi docker image
traefik.enable=true
traefik.http.routers.ombi.entrypoints=websecure
traefik.http.routers.ombi.rule=Host(`requests.somedns.com`)
# Specify the port your service should connect to (Optional if there is only one port)
traefik.http.services.ombi.loadbalancer.server.port=3579
# to tell traefik to try get a letsencrypt cert for your domain
traefik.http.routers.ombi.tls.certresolver=letsencrypt
#If you want to redirect port 80 to 443 when connecting to this domain on port 80
traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
traefik.http.routers.https-redirect.entrypoints=web
traefik.http.routers.https-redirect.middlewares=https-redirect
traefik.http.routers.https-redirect.rule=Host(`requests.somedns.com`)

 

Link to comment
  • 3 months later...
On 2/19/2020 at 2:50 AM, sstretchh said:

I figured out how to add labels to the docker containers in unraid, is there a way to do it with out using the GUI ? want to apply to other containers with out manually adding around 7 lines per container 

I don't believe there is.

 

The posts I have seen prefer the gui to be used to change the xml files, so I have added the traefik labels into configs in the dynamic traefik files instead.

 

it takes away some of the benefit of traefik, but it works.

Link to comment
  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.