# elasticsearch error: /usr/local/bin/docker-entrypoint.sh: cannot create temp file for here-document: Permission denied

**URL:** <https://discuss.elastic.co/t/elasticsearch-error-usr-local-bin-docker-entrypoint-sh-cannot-create-temp-file-for-here-document-permission-denied/365192>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting, docker\
**Created:** [August 20, 2024, 11:26am UTC](https://discuss.elastic.co/t/elasticsearch-error-usr-local-bin-docker-entrypoint-sh-cannot-create-temp-file-for-here-document-permission-denied/365192 "2024-08-20T11:26:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gomgom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gomgom/32/125887_2.png) [@gomgom](https://discuss.elastic.co/u/gomgom)\
**Post date:** [August 20, 2024, 11:26am UTC](https://discuss.elastic.co/t/elasticsearch-error-usr-local-bin-docker-entrypoint-sh-cannot-create-temp-file-for-here-document-permission-denied/365192/1 "2024-08-20T11:26:32Z")

</div>

I am new to elasticsearch and i want to install ELK on my linux local server using docker compose method. I took the .env and docker-compose files from the following url:

[[elasticsearch/docs/reference/setup/install/docker at 8.15 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/tree/8.15/docs/reference/setup/install/docker)]([https://stackoverflow.com/](https://stackoverflow.com/)](https://)

but when I want to up the container I get the following error:

```auto
WARN[0000] /workdir/app/elasticsearch/docker-compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
es01-1 | Created elasticsearch keystore in /usr/share/elasticsearch/config/elasticsearch.keystore
es03-1 | /usr/local/bin/docker-entrypoint.sh: line 84: cannot create temp file for here-document: Permission denied
setup-1 | Setting file permissions
setup-1 | Waiting for Elasticsearch availability
es01-1 | /usr/local/bin/docker-entrypoint.sh: line 73: cannot create temp file for here-document: Permission denied
es02-1 | /usr/local/bin/docker-entrypoint.sh: line 84: cannot create temp file for here-document: Permission denied

```

does anyone know why this is?

Thankyou

---

<div class="post-metadata">

**Author:** ![cmgzn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cmgzn/32/138513_2.png) [@cmgzn](https://discuss.elastic.co/u/cmgzn)\
**Post date:** [October 21, 2024, 7:14am UTC](https://discuss.elastic.co/t/elasticsearch-error-usr-local-bin-docker-entrypoint-sh-cannot-create-temp-file-for-here-document-permission-denied/365192/2 "2024-10-21T07:14:51Z")

</div>

I encountered a similar issue with the error message:

```bash
elasticsearch error: /usr/local/bin/docker-entrypoint.sh: cannot create temp file for here-document: Permission denied

```

After some troubleshooting, I found a workaround that worked for me. The solution involves rewriting the Dockerfile to change the permissions of the `/tmp` folder to `777`. Here's a basic example of how to modify the Dockerfile:

```dockerfile
FROM docker.elastic.co/elasticsearch/elasticsearch:8.15.2

USER root
# Change permissions for /tmp
RUN chmod 777 /tmp

USER elasticsearch

```

After building the new image with these changes, I was able to start the container without encountering the permission error.

This issue seems to stem from some underlying environmental problems, and while this workaround is effective, I can't pinpoint the exact root cause. For more details on this issue, you can refer to the discussion here: [Debuerreotype GitHub Issue #83](https://github.com/debuerreotype/docker-debian-artifacts/issues/83).

I hope this helps
