# Getting the following error while running lostash with docker

**URL:** <https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495>\
**Category:** Logstash\
**Created:** [July 1, 2016, 4:50am UTC](https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495 "2016-07-01T04:50:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivc](https://avatars.discourse-cdn.com/v4/letter/v/ce7236/32.png) [@vivc](https://discuss.elastic.co/u/vivc)\
**Post date:** [July 1, 2016, 4:50am UTC](https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495/1 "2016-07-01T04:50:16Z")

</div>

Errno::EACCES: Permission denied - /output  
mkdir at org/jruby/RubyDir.java:458  
fu\_mkdir at /opt/logstash/vendor/jruby/lib/ruby/1.9/fileutils.rb:247  
mkdir\_p at /opt/logstash/vendor/jruby/lib/ruby/1.9/fileutils.rb:221  
reverse\_each at org/jruby/RubyArray.java:1693  
mkdir\_p at /opt/logstash/vendor/jruby/lib/ruby/1.9/fileutils.rb:219  
each at org/jruby/RubyArray.java:1613  
mkdir\_p at /opt/logstash/vendor/jruby/lib/ruby/1.9/fileutils.rb:205  
open at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-file-2.2.5/lib/logstash/outputs/file.rb:253  
write\_event at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-file-2.2.5/lib/logstash/outputs/file.rb:162  
call at org/jruby/RubyProc.java:281  
encode at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-json\_lines-2.1.3/lib/logstash/codecs/json\_lines.rb:48  
receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-file-2.2.5/lib/logstash/outputs/file.rb:129  
multi\_receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/outputs/base.rb:83  
each at org/jruby/RubyArray.java:1613  
multi\_receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/outputs/base.rb:83  
worker\_multi\_receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/output\_delegator.rb:130  
multi\_receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/output\_delegator.rb:114  
output\_batch at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:301  
each at org/jruby/RubyHash.java:1342  
output\_batch at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:301  
worker\_loop at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:232  
start\_workers at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:201"

Already the permission are set using chmod 0777 for the output directory . Running logstash in docker container .

Command used for running logstash in docker.

---

<div class="post-metadata">

**Author:** ![vivc](https://avatars.discourse-cdn.com/v4/letter/v/ce7236/32.png) [@vivc](https://discuss.elastic.co/u/vivc)\
**Post date:** [July 1, 2016, 4:51am UTC](https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495/2 "2016-07-01T04:51:16Z")

</div>

sudo docker run -it --rm -v "$PWD":\<cofig\_file\_path\> logstash logstash -f /\<config\_file\_path\>/logstash.conf

Logstash.conf file:

input {  
beats {  
port =\> 5044  
}  
}

filter {  
mutate {  
remove\_field =\> ["beat", "count", "host", "year", "month", "day", "path", "@version", "tags", "input\_type", "type"]  
}  
}

output {  
stdout { codec =\> rubydebug }  
file {  
path =\> "output/2.txt"  
}  
}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 1, 2016, 5:34am UTC](https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495/3 "2016-07-01T05:34:11Z")

</div>

Please edit your post and move it to the Logstash category where it belongs.

I'm somewhat puzzled since the Logstash process you're starting in the container effectively runs as root, and it should be able to create /output inside the container.

However, that's not really what you want to happen right? It seems your expectation is to use the output subdirectory of the current directory, but that won't work as you've written things. You need to use the `-w` to start a container in a particular directory.

---

<div class="post-metadata">

**Author:** ![vivc](https://avatars.discourse-cdn.com/v4/letter/v/ce7236/32.png) [@vivc](https://discuss.elastic.co/u/vivc)\
**Post date:** [July 1, 2016, 5:53am UTC](https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495/4 "2016-07-01T05:53:14Z")

</div>

I've moved the category to logstash.

Yes , we want to create the output directory inside the container . But its throwing the error.

sudo docker run -w -it --rm -v "$PWD": logstash logstash -f [//logstash.conf](https://logstash.conf) , adding -w whether it will write the output to current directory (adding -w),

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 1, 2016, 6:14am UTC](https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495/5 "2016-07-01T06:14:16Z")

</div>

> Yes , we want to create the output directory inside the container

I still don't understand where you want the output file. Two options, pick out of them:

- In /output. Then use an absolute path in the file output's `path` option.
- In the output subdirectory of the directory from which you start the container. Then use the `-w` option to `docker run` so set the working directory of the container. That said, I'd general avoid using relative paths in Logstash configurations.

> sudo docker run -w -it --rm -v "$PWD": logstash logstash -f [//logstash.conf](https://logstash.conf) , adding -w whether it will write the output to current directory (adding -w),

The `-w` option takes a string argument, e.g. `-w /path/to/some/dir`. And why do you have double slashes in front of "logstash.conf"?

---

<div class="post-metadata">

**Author:** ![vivc](https://avatars.discourse-cdn.com/v4/letter/v/ce7236/32.png) [@vivc](https://discuss.elastic.co/u/vivc)\
**Post date:** [July 1, 2016, 7:23am UTC](https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495/6 "2016-07-01T07:23:45Z")

</div>

I tried with absolute path also but it was giving same error permission denied. There is no // before logstash.

I'll try with -w option , i understand this will not log the output to the docker instead it will log in to the current directory where i run the docker.

---

<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 22, 2016, 4:50am UTC](https://discuss.elastic.co/t/getting-the-following-error-while-running-lostash-with-docker/54495/7 "2016-07-22T04:50:36Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
