8

I'm following this post:

http://eric-price.net/blog/centralized-logging-docker-aws-elasticsearch

This is what my docker-compose.yml looks like :

version: "2"

services:

  fluentd:
    image: fluent/fluentd:latest
    ports:
      - "24224:24224"
    command: start.sh
    networks:
      - lognet

  nginx:
    image: nginx-pixel
    ports:
      - "80:80"
    logging:
      driver: fluentd
    networks:
      - lognet

networks:
  lognet:
    driver: bridge

my start.sh is in the same directory as the yml file. When I run docker-compose up -d this is what I get :

ERROR: for fluentd Cannot start service fluentd: oci runtime error: exec: "start.sh": executable file not found in $PATH ERROR: Encountered errors while bringing up the project.

My docker-compose info:

docker-compose version 1.8.0, build f3628c7
docker-py version: 1.9.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
tyrell_c
  • 503
  • 3
  • 10
  • 24

1 Answers1

7

The command is executed inside the container- you are using a pulled fluentd container which does not have your start.sh file in it. You can either

A. bind mount it into the container

#docker-compose.yml
  fluentd:
    image: fluent/fluentd:latest
    volumes:
      - ./start.sh:/start.sh
    command: /start.sh

or B. build it into the image

# Dockerfile
FROM fluent/fluentd:latest
COPY start.sh /start.sh

#docker-compose.yml
  fluentd:
    build: .
Paul Becotte
  • 9,767
  • 3
  • 34
  • 42
  • Thanks. I fixed it by adding this in my docker-compose : `volumes:- ./fluentd/etc:/fluentd/etc` `command: /fluentd/etc/start.sh` – tyrell_c Sep 23 '16 at 17:26
  • 1
    From reading that blog post, that start.sh is not a good practice- you should run the gem installs in a Dockerfile so that you don't have to re-install them every time you run your container. – Paul Becotte Sep 23 '16 at 17:30