# Use Bind-Mounted Setting for Local Config File?

**URL:** <https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500>\
**Category:** Logstash\
**Created:** [June 24, 2020, 2:12pm UTC](https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500 "2020-06-24T14:12:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![redapplesonly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redapplesonly/32/57700_2.png) [@redapplesonly](https://discuss.elastic.co/u/redapplesonly)\
**Post date:** [June 24, 2020, 2:12pm UTC](https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500/1 "2020-06-24T14:12:58Z")

</div>

Hello Logstash Wizards,

I’m struggling to understand how I can spin up a Logstash Docker container using bind-mounted settings ([see here](https://www.elastic.co/guide/en/logstash/current/docker-config.html)) to run the container with a config file on the local host.

To explain: Let’s say I have this Logstash config file ( _ **/home/me/myconfig.conf** _ ) on my Ubuntu server:

```
input{
  ...stuff...
}

filter{
  ...more stuff...
}

output{
  ...still more stuff...
}

```

I want to force the Logstash Docker container to run this config file when it spins up. So I create a custom logstash.yml file ( _ **/home/me/logstash.yml** _ ):

```
http.host: 0.0.0.0
path.config: /usr/share/logstash/config/myconfig.conf

```

And I set ownership and permissions on these files like this:

```
root@ubuntuhost:/home/me# ls -l
total 32
-rwxrwxrwx 1 logstash root 81 Jun 23 21:05 logstash.yml
-rwxrwxrwx 1 logstash root 28 Jun 12 19:16 myconfig.conf
root@ubuntuhost:/home/me#

```

A little overkill, but I don’t want any problems with the container being unable to access the files.

Now all I have to do is spin up the container, and make sure it understands where to find these two files on my host system:

```
docker run -it -d \
-v /home/me/logstash.yml:/usr/share/logstash/config/logstash.yml \
-v /home/me/myconfig.conf:/usr/share/logstash/config/myconfig.conf \
logstash:latest

```

What I’ve determined from trial-and-error is that the container can successfully access and read the _ **logstash.yml** _ file, but cannot access the _ **myconfig.conf** _ file. So I must be doing something wrong with that binding. I thought that this part of the spin-up command…

`-v /home/me/myconfig.conf:/usr/share/logstash/config/myconfig.conf \`

…essentially created a logical link within the container to my local file. Can anyone see what I’m doing wrong? Thanks, -RAO

---

<div class="post-metadata">

**Author:** ![ptamba](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@ptamba](https://discuss.elastic.co/u/ptamba)\
**Post date:** [June 25, 2020, 2:00am UTC](https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500/2 "2020-06-25T02:00:54Z")

</div>

could [this](https://discuss.elastic.co/t/elasticsearch-index-not-created-after-adding-logstash-works-fine-with-filebeat-es/237374/14) be the issue ?

---

<div class="post-metadata">

**Author:** ![redapplesonly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redapplesonly/32/57700_2.png) [@redapplesonly](https://discuss.elastic.co/u/redapplesonly)\
**Post date:** [June 25, 2020, 8:55pm UTC](https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500/3 "2020-06-25T20:55:10Z")

</div>

Thanks ptamba,

No, I'm afraid that isn't the solution. When I apply the ":ro" ("Read Only") at the end of the filename, it actually generates an error:

```
2020/06/25 20:47:37 Setting 'xpack.monitoring.elasticsearch.hosts' from environment.
2020/06/25 20:47:37 error: open /usr/share/logstash/config/logstash.yml: read-only file system

```

And when I drop the ":ro", it generates a massive Java error. Perhaps a bug in this version? (7.7.1)

I've been Googling for a while today; there doesn't seem to be an example of spinning up a LS Docker Container while bind-mounting the local config file.

---

<div class="post-metadata">

**Author:** ![ptamba](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@ptamba](https://discuss.elastic.co/u/ptamba)\
**Post date:** [June 26, 2020, 3:47am UTC](https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500/4 "2020-06-26T03:47:52Z")

</div>

> [@redapplesonly](#):
>
> ```auto
> -v /home/me/myconfig.conf:/usr/share/logstash/config/myconfig.conf \
> logstash:latest
> 
> ```

i was referring to the config files. logstash in docker will look for the config in /usr/share/logstash/pipeline . your config uses /usr/share/logstash/config

have you tried this instead?

```
-v /home/me/myconfig.conf:/usr/share/logstash/pipeline/logstash.conf \
logstash:latest

```

---

<div class="post-metadata">

**Author:** ![redapplesonly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redapplesonly/32/57700_2.png) [@redapplesonly](https://discuss.elastic.co/u/redapplesonly)\
**Post date:** [June 26, 2020, 8:45pm UTC](https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500/5 "2020-06-26T20:45:27Z")

</div>

...interesting! Yes, I will try over the weekend. Thanks, I'll let you know how it goes!

---

<div class="post-metadata">

**Author:** ![redapplesonly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redapplesonly/32/57700_2.png) [@redapplesonly](https://discuss.elastic.co/u/redapplesonly)\
**Post date:** [June 29, 2020, 8:27pm UTC](https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500/6 "2020-06-29T20:27:31Z")

</div>

Yes, this worked, thank you!

A word of warning to anyone who might be following in my footsteps... You have to make sure to set permissions on the local files for this to work.

---

<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:** [July 27, 2020, 8:37pm UTC](https://discuss.elastic.co/t/use-bind-mounted-setting-for-local-config-file/238500/7 "2020-07-27T20:37:48Z")

</div>

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