If I execute this cmd in a console:
docker run -it --rm --link rabbit --link elasticsearch -v \"$PWD\"/logstash:/config-dir logstash logstash -f /config-dir
Your config is probably not working because your version of docker-compose does not execute shell expansions while creating your container. That means that docker compose is trying to find a literal path $PWD/logstash instead of expanding $PWD to your present directory. Later versions of docker compose do allow for environment variable expansion.
Docker-compose does allow relative paths though, through the use of ./, which references the folder the compose file is in, not necessarily your pwd, so you just need to change your compose file to be:
volumes:
- ./logstash:/config_dir