docker撰写oci运行时错误,$ PATH中找不到可执行文件

时间:2016-09-23 16:55:46

标签: nginx docker yaml docker-compose fluentd

我关注这篇文章:

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

这就是我的docker-compose.yml的样子:

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

我的start.sh与yml文件位于同一目录中。当我运行docker-compose up -d时,这就是我得到的:

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.

我的码头撰写信息:

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

1 个答案:

答案 0 :(得分:3)

命令在容器内执行 - 你使用的是一个拉出的流畅容器,里面没有你的start.sh文件。你可以

一个。 bind将它挂载到容器中

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

或B.将其构建到图像

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

#docker-compose.yml
  fluentd:
    build: .