April 9, 20197 yr 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 April 9, 20197 yr by hpka Added retrospective.
February 17, 20206 yr 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`)
February 19, 20206 yr 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
June 12, 20206 yr 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.
September 15, 20232 yr I would like to push this thread. I am also in need to add a bunch of labels per container. Is there a way to do this in a file, and not in GUI?
July 29, 20242 yr i created this plugin to solve this https://github.com/phyzical/docker.labelInjector
July 29, 20242 yr Community Expert Also worth noting docker has an option to specify container labels via a file using the option --label-file. It can be specified in Dockerman's extra arguments field.
August 4, 20241 yr On 7/29/2024 at 10:45 AM, primeval_god said: Also worth noting docker has an option to specify container labels via a file using the option --label-file. It can be specified in Dockerman's extra arguments field. This makes it super convenient to add any number of predefined label groups. The issue with using it for Traefik labels is that you can't pre-define the label file with substitutions/variables, so it's not convenient to get the container's name into a label value. On 7/29/2024 at 9:09 AM, phyzical said: i created this plugin to solve this https://github.com/phyzical/docker.labelInjector I gave this a quick test and notice that key.value pairs aren't saved, nor can they be pre-defined by the plugin. It also requires pairs to be entered one at a time and into two different fields, which makes editing a bit slow. Maybe you can consider adding a configuration to the plugin where you can set up some defaults? And with variable substitution support so that the same defaults can easily be reused. Example: traefik.enable=true traefik.http.routers.$containername.entryPoints=https traefik.http.routers.$containername.rule=Host($containername.$TLD) traefik.http.services.$containername.loadbalancer.server.port=$containerport Edited August 4, 20241 yr by Espressomatic
August 13, 20241 yr @Espressomaticthanks for the feedback, yeah i kinda just got it working for a simple case, did what i needed it to. ive got to be honest the unraid under the hood isn't the nicest to play with, i spent alot longer trying to do the simple things that i lost alot of motivation to make it fancier But im sure ill get some time at some point to make it more magic like your thinking If i do * yeah maybe a config that defines a list of variables that can be referenced * list of defaults * prefill with existing containers for selection/modification
August 26, 20241 yr @Espressomatic Hey ended up needing to add more labels for other things, so i had to motivation to touch it up again. it now has * a better select field * ability to add defaults to be prefilled each time via the settings page * ability to provide ${CONTAINER_NAME} for auto replacement The only thing i didnt do was prefilling with existing labels based on container selections as i felt it might just ends up being more annoying than useful Edited August 26, 20241 yr by phyzical
August 26, 20241 yr Very nice, this is going to be a huge time-saver for anyone using Traefik with Unraid's default Docker apps.
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.