# Fail to load SSL configuration while using docker image

**URL:** <https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security, docker\
**Created:** [April 29, 2020, 2:09am UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283 "2020-04-29T02:09:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![x0rcist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/x0rcist/32/66605_2.png) [@x0rcist](https://discuss.elastic.co/u/x0rcist)\
**Post date:** [April 29, 2020, 2:09am UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/1 "2020-04-29T02:09:17Z")

</div>

Hi,

Trying to install Elasticsearch latest version via docker.

I have created certificate already and pushing it to image like below, excerpt from yml

volumes:  
- ./elastic-stack-ca.p12:/usr/share/elasticsearch/config/elastic-stack-ca.p12

```auto
<stacktrace": ["org.elasticsearch.bootstrap.StartupException: ElasticsearchSecurityException[failed to load SSL configuration [xpack.security.transport.ssl]]; nested: ElasticsearchException[failed to initialize SSL TrustManager - not permitted to read truststore file [/usr/share/elasticsearch/config/elastic-stack-ca.p12]]; nested: AccessDeniedException[/usr/share/elasticsearch/config/elastic-stack-ca.p12]; />

```

I can see its access issue but not sure how to fix it. like how to grant access to that location cause docker container exits after that exception and can't use commands like exec --it bash to change the file permission.

Any thoughts

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [April 29, 2020, 9:28am UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/2 "2020-04-29T09:28:42Z")

</div>

Assuming that you are using our official image ( and if you don't, [you should](https://www.elastic.co/guide/en/elastic-stack-get-started/current/get-started-docker.html) ) , the user that elasticsearch runs under [has a UID of 1000](https://github.com/elastic/dockerfiles/blob/7.6/elasticsearch/Dockerfile#L20) so you should make sure that the `elastic-stack-ca.p12` is owned by that user ( `chown 1000:0 elastic-stack-ca.p12` ) or it is readable by all users.

---

<div class="post-metadata">

**Author:** ![x0rcist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/x0rcist/32/66605_2.png) [@x0rcist](https://discuss.elastic.co/u/x0rcist)\
**Post date:** [April 29, 2020, 9:31am UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/3 "2020-04-29T09:31:40Z")

</div>

thanks so should I add it as  
CMD chowon 1000:0 elastic-stack-ca.p12  
in the docker file or is there any better way?

---

<div class="post-metadata">

**Author:** ![x0rcist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/x0rcist/32/66605_2.png) [@x0rcist](https://discuss.elastic.co/u/x0rcist)\
**Post date:** [April 29, 2020, 1:52pm UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/4 "2020-04-29T13:52:57Z")

</div>

here is my yml file

```
version: '3'

services:

  elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elasticsearch
environment:
  - node.name=elasticsearch
  - discovery.seed_hosts=elasticsearch
  - cluster.initial_master_nodes=elasticsearch
  - cluster.name=docker-cluster
  - bootstrap.memory_lock=true
  - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
 # - xpack.security.enabled=true
 # - xpack.security.transport.ssl.enabled=true
 # - xpack.security.transport.ssl.keystore.type=PKCS12
 # - xpack.security.transport.ssl.verification_mode=certificate
 # - xpack.security.transport.ssl.keystore.path=elastic-stack-ca.p12
 # - xpack.security.transport.ssl.truststore.path=elastic-stack-ca.p12
 # - xpack.security.transport.ssl.truststore.type=PKCS12
ulimits:
  memlock:
    soft: -1
    hard: -1
volumes:
  - ./elastic-stack-ca.p12:/usr/share/elasticsearch/config/elastic-stack-ca.p12
  - esdata1:/usr/share/elasticsearch/data
ports:
  - 9200:9200

*command: chown -R 1000:0 /usr/share/elasticsearch/*
  kibana:
image: docker.elastic.co/kibana/kibana:7.4.2
container_name: kibana
environment:
  ELASTICSEARCH_URL: "http://elasticsearch:9200"
  ELASTICSEARCH_USERNAME: "kibana"
  ELASTICSEARCH_PASSWORD: "kibana"
ports:
  - 5601:5601
depends_on:
  - elasticsearch

volumes:
  esdata1:
driver: local

```

I m not sure where to add the command so it run at appropriate time. tried few places but gives me error.

Any advise?

---

<div class="post-metadata">

**Author:** ![x0rcist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/x0rcist/32/66605_2.png) [@x0rcist](https://discuss.elastic.co/u/x0rcist)\
**Post date:** [April 30, 2020, 9:20am UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/5 "2020-04-30T09:20:37Z")

</div>

no love ☹

---

<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:** [April 30, 2020, 9:33am UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/6 "2020-04-30T09:33:19Z")

</div>

Please be patient in waiting for responses to your question and refrain from pinging multiple times asking for a response or opening multiple topics for the same question. This is a community forum, it may take time for someone to reply to your question. For more information please refer to the [Community Code of Conduct](https://www.elastic.co/community/codeofconduct) specifically the section "Be patient". Also, please refrain from pinging folks directly, this is a forum and anyone that participates might be able to assist you.

If you are in need of a service with an SLA that covers response times for questions then you may want to consider talking to us about a [subscription](https://www.elastic.co/subscriptions).

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

---

<div class="post-metadata">

**Author:** ![x0rcist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/x0rcist/32/66605_2.png) [@x0rcist](https://discuss.elastic.co/u/x0rcist)\
**Post date:** [April 30, 2020, 11:38am UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/7 "2020-04-30T11:38:27Z")

</div>

I try to observe the code of conduct, its for our common good.

here is an except from the "Be patient" section  
` One reminder ping is welcome, many reminder pings in rapid succession are not a good display of patience.`

As one can see I posted some details and then YML, to elaborate and then ping , one ping. So I thought I was under the norms. Had no intention flood it. I much appreciate volunteer response and we learn a lot from such forums. Respect and thanks for all contributors.

One comment though: wouldn't it be 'nicer' if some help was also provided besides policing .

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [April 30, 2020, 1:18pm UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/8 "2020-04-30T13:18:14Z")

</div>

I stand with what David said above, please be patient, we all do our best around here 🙂

> [@x0rcist](#):
>
> One comment though: wouldn't it be 'nicer' if some help was also provided besides policing .

Not everyone has the time, insights, or a ready answer for each of the questions, that doesn't mean that bringing up the code of conduct of the forums is a bad approach. Don't consider this as policing, but rather as a friendly reminder. It had only been 19hrs since you asked the previous question 🙂

Answering your original question: you don't need to do this as part of your docker compose file. Do it once, for your existing elastic-stack-ca.p12 file and then map it as a volume, as you already do

---

<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, 2020, 1:18pm UTC](https://discuss.elastic.co/t/fail-to-load-ssl-configuration-while-using-docker-image/230283/9 "2020-05-28T13:18:24Z")

</div>

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