# How can I set the user the docker image is running under?

**URL:** <https://discuss.elastic.co/t/how-can-i-set-the-user-the-docker-image-is-running-under/80056>\
**Category:** Elasticsearch\
**Created:** [March 26, 2017, 9:52pm UTC](https://discuss.elastic.co/t/how-can-i-set-the-user-the-docker-image-is-running-under/80056 "2017-03-26T21:52:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kazama](https://avatars.discourse-cdn.com/v4/letter/k/d07c76/32.png) [@Kazama](https://discuss.elastic.co/u/Kazama)\
**Post date:** [March 26, 2017, 9:52pm UTC](https://discuss.elastic.co/t/how-can-i-set-the-user-the-docker-image-is-running-under/80056/1 "2017-03-26T21:52:43Z")

</div>

I start some dockered elastic nodes as described in [https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html)

On the host in "top" output I see some java processes running under user id 1000.  
Can I change it somehow to a particular user id?

---

<div class="post-metadata">

**Author:** ![Kazama](https://avatars.discourse-cdn.com/v4/letter/k/d07c76/32.png) [@Kazama](https://discuss.elastic.co/u/Kazama)\
**Post date:** [March 29, 2017, 6:35pm UTC](https://discuss.elastic.co/t/how-can-i-set-the-user-the-docker-image-is-running-under/80056/2 "2017-03-29T18:35:04Z")

</div>

Got resolved it by myself.

It runs under user id 1000 because of this piece under the manifest/history:

```
"container_config": {
        "Cmd": [
            "/bin/sh -c adduser -D -u 1000 -h /usr/share/elasticsearch elasticsearch"
        ]
    }

```

So the user it will use to run the server process under is created as id=1000.

I resolved it with the **userns-remap** feature via /etc/docker/daemon.json

```
{
    "userns-remap": "default"
}

```

(I don't care which user is gonna be used for remapping that's why **default**.)

---

<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, 2017, 6:35pm UTC](https://discuss.elastic.co/t/how-can-i-set-the-user-the-docker-image-is-running-under/80056/3 "2017-04-26T18:35:07Z")

</div>

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