# Changing the default user in logstash docker image build

**URL:** <https://discuss.elastic.co/t/changing-the-default-user-in-logstash-docker-image-build/271775>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [April 30, 2021, 12:57pm UTC](https://discuss.elastic.co/t/changing-the-default-user-in-logstash-docker-image-build/271775 "2021-04-30T12:57:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gorbroth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gorbroth/32/105251_2.png) [@gorbroth](https://discuss.elastic.co/u/gorbroth)\
**Post date:** [April 30, 2021, 12:57pm UTC](https://discuss.elastic.co/t/changing-the-default-user-in-logstash-docker-image-build/271775/1 "2021-04-30T12:57:02Z")

</div>

I've been tying to run my logstash as a docker container using a self created user on cent os 7 . But from what it looks like the image [docker.elastic.co/logstash/logstash:6.4.2](http://docker.elastic.co/logstash/logstash:6.4.2) creates it use Logstash user . Went through the documentation of this image and this creation of user is defined in Dockerfile.j2 . Wanted to know if it would be a good idea to change this to my local user in this file and then build the image ?  
[GitHub - elastic/logstash-docker at 6.4](https://github.com/elastic/logstash-docker/tree/6.4)

```auto
        # Provide a non-root user to run the process.
    RUN groupadd --gid 1000 logstash && \
        adduser --uid 1000 --gid 1000 \
          --home-dir /usr/share/logstash --no-create-home \
          logstash

    # Add Logstash itself.
    RUN curl -Lo - {{ url_root }}/{{ tarball }} | \
        tar zxf - -C /usr/share && \
        mv /usr/share/logstash-{{ elastic_version }} /usr/share/logstash && \
        chown --recursive logstash:logstash /usr/share/logstash/ && \
        chown -R logstash:root /usr/share/logstash && \
        chmod -R g=u /usr/share/logstash && \
        find /usr/share/logstash -type d -exec chmod g+s {} \; && \
        ln -s /usr/share/logstash /opt/logstash  

```

---

<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:** [May 28, 2021, 12:57pm UTC](https://discuss.elastic.co/t/changing-the-default-user-in-logstash-docker-image-build/271775/2 "2021-05-28T12:57:17Z")

</div>

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