Docker Community Forums

Share and learn in the Docker community.

Understanding running docker logstash container command

docker

(Marwenb) #1

Hello every one,
I’m working on creating the container logstash using docker run
I found this commande and i want to understand what is means ,

docker run -d --name=logstash --restart=unless-stopped --link elasticsearch:elasticsearch -v /srv/docker/logstash/etc:/config-dir --volumes-from syslog-ng logstash:2.3 -f /config-dir/logstash.conf

/srv/docker/logstash/etc:/config-dir : i don’t understand the config-dir , i’m expecting a path not this
-f : i don’t understanf the -f option why it’s used

Thank you for your help


(Sam) #2

well, broken down this is

docker run 
  -d 
  --name=logstash
  --restart=unless-stopped
  --link elasticsearch:elasticsearch
  -v /srv/docker/logstash/etc:/config-dir 
  --volumes-from syslog-ng
  logstash:2.3 
  -f /config-dir/logstash.conf

so, the -f is parms to the logstash container

and from its doc
https://hub.docker.com/_/logstash/

Start Logstash with configuration file
If you need to run logstash with a configuration file, logstash.conf, that's located in your current directory, you can use the logstash image as follows:

$ docker run -it --rm -v "$PWD":/config-dir logstash -f /config-dir/logstash.conf

(Marwenb) #3

Thank you for your response,
what i’m searching for now is the config-dir , it’s where i can put the config file inside the container


(Sam) #4

the command maps the current directory onto the named container folder called config-dir…

-v “$PWD”:/config-dir