# How to change userid in docker contianer for bind mounting config / data?

**URL:** <https://discuss.elastic.co/t/how-to-change-userid-in-docker-contianer-for-bind-mounting-config-data/173097>\
**Category:** Elasticsearch\
**Created:** [March 20, 2019, 8:24am UTC](https://discuss.elastic.co/t/how-to-change-userid-in-docker-contianer-for-bind-mounting-config-data/173097 "2019-03-20T08:24:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asp](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@asp](https://discuss.elastic.co/u/asp)\
**Post date:** [March 20, 2019, 8:24am UTC](https://discuss.elastic.co/t/how-to-change-userid-in-docker-contianer-for-bind-mounting-config-data/173097/1 "2019-03-20T08:24:28Z")

</div>

Hi,

the container for logstash, elasticsearch and kibana are using user:group 1000:1000 inside of the container.

If I would like to use bind mounts to link in custom configuration or the data folder, I need to give user 1000:1000 read (for config) and write (for data) permissions on the host to these folders.

What is best practice if userid 1000 is already in use? I don't want to need give the user who is already using the id on the host a new id. In centos for example the first user who is created gets userid 1000 by default. So taking id 1000 for elasticsearch may collide quite often.

So what's best practice?

1. change userid in docker container to the one matching which is used for user elasticsearch on the host?
2. use volumes?  
2.1. I assume volumes are slower than bind mounts. Can one neglect the speed difference? What is the common difference in percent?
3. Any other approach

Thanks, Andreas

---

<div class="post-metadata">

**Author:** ![asp](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@asp](https://discuss.elastic.co/u/asp)\
**Post date:** [March 29, 2019, 7:55am UTC](https://discuss.elastic.co/t/how-to-change-userid-in-docker-contianer-for-bind-mounting-config-data/173097/2 "2019-03-29T07:55:32Z")

</div>

my solution for now is modifying elastic's docker image. I am changing user and group IDs to my needs and changing the ownership of the files to fit to the new IDs. Id's are defined as build-arg.

So I just followed the steps here:

> **[Linux: Changing UIDs and GIDs for a user](https://muffinresearch.co.uk/linux-changing-uids-and-gids-for-user/)**
>
> Just had to do a quick switch over of UID and GIDs for a couple of users. I'm using Puppet to manage server configurations and it's got some nice features for automating the set-up of users. Unfortunately when I initially set-up the puppet...

Maybe it helps someone 😉

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 26, 2019, 7:55am UTC](https://discuss.elastic.co/t/how-to-change-userid-in-docker-contianer-for-bind-mounting-config-data/173097/3 "2019-04-26T07:55:37Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
