# Set Password and user with Docker-compose

**URL:** <https://discuss.elastic.co/t/set-password-and-user-with-docker-compose/225075>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [March 25, 2020, 10:20pm UTC](https://discuss.elastic.co/t/set-password-and-user-with-docker-compose/225075 "2020-03-25T22:20:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 25, 2020, 10:38pm UTC](https://discuss.elastic.co/t/set-password-and-user-with-docker-compose/225075/2 "2020-03-25T22:38:02Z")

</div>

Here is how I'm setting that with docker compose ( `docker-compose.yml`):

```auto
---
version: '3'
services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:$ELASTIC_VERSION
    environment:
      - bootstrap.memory_lock=true
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
      - ELASTIC_PASSWORD=$ELASTIC_PASSWORD
      - xpack.security.enabled=$ELASTIC_SECURITY
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - 9200:9200
    networks: ['stack']

  kibana:
    image: docker.elastic.co/kibana/kibana:$ELASTIC_VERSION
    environment:
      - ELASTICSEARCH_USERNAME=elastic
      - ELASTICSEARCH_PASSWORD=$ELASTIC_PASSWORD
    ports: ['5601:5601']
    networks: ['stack']
    links: ['elasticsearch']
    depends_on: ['elasticsearch']

networks:
  stack: {}

```

`.env` file is:

```auto
ELASTIC_VERSION=7.6.1
ELASTIC_SECURITY=true
ELASTIC_PASSWORD=changeme

```

---

_[View the full topic](https://discuss.elastic.co/t/set-password-and-user-with-docker-compose/225075)._
