# Docker+elasticsearch: access is denied when creating the log file

**URL:** <https://discuss.elastic.co/t/docker-elasticsearch-access-is-denied-when-creating-the-log-file/84543>\
**Category:** Elasticsearch\
**Created:** [May 4, 2017, 11:40am UTC](https://discuss.elastic.co/t/docker-elasticsearch-access-is-denied-when-creating-the-log-file/84543 "2017-05-04T11:40:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nskalis](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@nskalis](https://discuss.elastic.co/u/nskalis)\
**Post date:** [May 4, 2017, 11:40am UTC](https://discuss.elastic.co/t/docker-elasticsearch-access-is-denied-when-creating-the-log-file/84543/1 "2017-05-04T11:40:11Z")

</div>

I am trying to run elasticsearch (5.3.0) in a docker container like this:

```
    docker run 
    --network=host 
    --publish 9203:9200 
    --publish 9300:9300 
    --env ES_JAVA_OPTS="-Xms4g -Xmx4g" 
    --env "bootstrap.memory_lock=true" 
    --cap-add=IPC_LOCK 
    --ulimit memlock=-1:-1 --ulimit nofile=65536:65536 
    --volume /etc/elasticsearch/ip-spotlight.elasticsearch.RR6.yml:/usr/share/elasticsearch/config/elasticsearch.yml 
    --volume /usr/ip-spotlight/elasticsearch/RR6:/usr/share/elasticsearch/data 
    --volume /var/log/elasticsearch:/usr/share/elasticsearch/logs 
    --label app="ip-spotlight" 
    --label service="elasticsearch" 
    --label func="RR6" 
    --name "ip-spotlight.elasticsearch.RR6" 
    docker.elastic.co/elasticsearch/elasticsearch:5.3.2

```

SElinux is disabled (in order to be completely sure):

```
    # getenforce
    Disabled

```

And in order to be completely sure here are the permissions of `/var/log/elasticsearch`:

```
    # ls -salt /var/log/elasticsearch/
    total 8
    4 drwxrwxrwx. 2 elasticsearch elasticsearch 4096 May 4 15:12 .

    # cat /etc/*release*
    CentOS Linux release 7.3.1611 (Core) 
    Derived from Red Hat Enterprise Linux 7.3 (Source)
    NAME="CentOS Linux"
    VERSION="7 (Core)"
    ID="centos"
    ID_LIKE="rhel fedora"
    VERSION_ID="7"
    PRETTY_NAME="CentOS Linux 7 (Core)"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:centos:centos:7"
    HOME_URL="https://www.centos.org/"
    BUG_REPORT_URL="https://bugs.centos.org/"
    
    CENTOS_MANTISBT_PROJECT="CentOS-7"
    CENTOS_MANTISBT_PROJECT_VERSION="7"
    REDHAT_SUPPORT_PRODUCT="centos"
    REDHAT_SUPPORT_PRODUCT_VERSION="7"
    
    CentOS Linux release 7.3.1611 (Core) 
    CentOS Linux release 7.3.1611 (Core) 
    cpe:/o:centos:centos:7

```

And the error message getting displayed is:

`2017-05-04 13:10:24,621 main ERROR Unable to create file /var/log/elasticsearch/ip-spotlight.elasticsearch.RR6_access.log java.io.IOException: No such file or directory`

EDIT: official documentations says The container runs Elasticsearch as user elasticsearch using uid:gid 1000:1000. Bind mounted host directories and files, such as custom\_elasticsearch.yml above, need to be accessible by this user. but on the server, having installed also elasticsearch as a service I see that:

```
$ id elasticsearch
uid=990(elasticsearch) gid=988(elasticsearch) groups=988(elasticsearch)

```

Please note that I did `chmod 777` in all related files and directories.  
Could you please advise on how-to resolve this ?

---

<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:** [June 1, 2017, 11:47am UTC](https://discuss.elastic.co/t/docker-elasticsearch-access-is-denied-when-creating-the-log-file/84543/2 "2017-06-01T11:47:03Z")

</div>

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