【问题标题】:docker compose oci runtime error, executable file not found in $PATHdocker compose oci 运行时错误,在 $PATH 中找不到可执行文件
【发布时间】:2016-09-23 16:55:46
【问题描述】:

我正在关注这篇文章:

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 信息:

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

【问题讨论】:

    标签: nginx docker yaml docker-compose fluentd


    【解决方案1】:

    该命令在容器内执行 - 您正在使用拉出的 fluentd 容器,其中没有您的 start.sh 文件。你可以

    A.绑定挂载到容器中

    #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: .
    

    【讨论】:

    • 谢谢。我通过在我的 docker-compose 中添加它来修复它:volumes:- ./fluentd/etc:/fluentd/etccommand: /fluentd/etc/start.sh
    • 从阅读那篇博文后,start.sh 不是一个好习惯——您应该在 Dockerfile 中运行 gem 安装,这样您就不必在每次运行时重新安装它们容器。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-08
    • 1970-01-01
    • 2019-01-16
    • 2015-01-25
    • 1970-01-01
    • 2021-11-23
    • 2017-09-25
    相关资源
    最近更新 更多