# Use scale number from container in docker-compose.yml

**URL:** <https://forums.suse.com/t/use-scale-number-from-container-in-docker-compose-yml/5772>\
**Category:** Rancher 1.x\
**Created:** [March 7, 2017, 5:03pm UTC](https://forums.suse.com/t/use-scale-number-from-container-in-docker-compose-yml/5772 "2017-03-07T17:03:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![huehnerlady](https://avatars.discourse-cdn.com/v4/letter/h/c2a13f/32.png) [@huehnerlady](https://forums.suse.com/u/huehnerlady)\
**Post date:** [March 7, 2017, 5:03pm UTC](https://forums.suse.com/t/use-scale-number-from-container-in-docker-compose-yml/5772/1 "2017-03-07T17:03:21Z")

</div>

Hello,

We use docker for our Jenkins-buildslaves and want to use rancher for scaling and recreating the slave-containers. As we use the Jenkins-swarm-plugin we need an environment variable for labeling them in a unique way.

**docker-compose.yml:**

```
 [...]
 environment:
   JENKINS_SLAVE_NAME: buildslave-01
 [...]

```

We need to adapt the Jenkins\_slave\_name due to the name of the docker-container. We cannot find any environment variable to get these information though.  
we thought we could use something like the variables you can define in the rancher-compose file, but the scaling function doesn’t adapt these variables.

Is there a trick to get that information? It doesn’t necessarily have to be the whole name, the number would be sufficient.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [March 7, 2017, 7:29pm UTC](https://forums.suse.com/t/use-scale-number-from-container-in-docker-compose-yml/5772/2 "2017-03-07T19:29:07Z")

</div>

Environment variable substitutions are not evaluated per-individual container. One way you can do this is to have the entry point talk to rancher-metadata and get info about itself, which has various things you could use like the container’s `name` and `createIndex`.

---

<div class="post-metadata">

**Author:** ![VAdamec](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vadamec/32/2115_2.png) [@VAdamec](https://forums.suse.com/u/VAdamec)\
**Post date:** [March 8, 2017, 7:56am UTC](https://forums.suse.com/t/use-scale-number-from-container-in-docker-compose-yml/5772/3 "2017-03-08T07:56:05Z")

</div>

Do you really need exact slave name ? Slave with same tag/flag need to be same, there is normally no need to have exact slave name and scale it. See how jenkins swarm plugin works, I used several types of Jenkins agents with labels and scale just needed selected farm/service.
