简体   繁体   English

启动容器过程导致“ exec:\\\\” tail -f / dev / null \\\\”:统计信息尾巴-f / dev / null:无此类文件或目录

[英]Starting container process caused “exec: \\”tail -f /dev/null\\": stat tail -f /dev/null: no such file or directory

Because I am trying to keep a container running I specified the " tail -f /dev/null " as command in the docker compose file: 因为我试图保持容器运行,所以在docker compose文件中将“ tail -f / dev / null ”指定为命令

version: '2'
services:
  serviceName:
  .
  .
  .

  command:
    - tail -f /dev/null
  stdin_open: true
  tty: true
  .
  .
  .

After I run docker-compose up I get the following error: 在运行docker-compose up之后,出现以下错误:

ERROR: for serviceName Cannot start service serviceName: b'OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \\"tail -f /dev/null\\": stat tail -f /dev/null: no such file or directory" : unknown' ERROR: Encountered errors while bringing up the project. 错误:用于serviceName无法启动服务serviceName:b'OCI运行时创建失败:container_linux.go:348:启动容器进程引起“ exec:\\” tail -f / dev / null \\”:stat tail -f / dev / null:没有这样的文件或目录” :未知”错误:启动项目时遇到错误。

However if I start the container from the CLI with the same command it works perfectly. 但是,如果我使用相同的命令从CLI启动容器,则可以正常运行。

What actually happens under the hood and how can I make this work ? 实际情况是如何发生的,我该如何进行这项工作?

Linux version of the container is: 4.9.87-linuxkit-aufs . 容器的Linux版本是: 4.9.87-linuxkit-aufs

The host machine uses Windows 10 OS and the Docker for Windows version is: 18.03.1-ce-win65 (17513), docker compose 1.21.1 主机使用Windows 10 OS,Windows的Docker版本为:18.03.1-ce-win65(17513),docker compose 1.21.1

Would suggest trying: 建议尝试:

command:
  - tail
  - -f
  - /dev/null

From the error message docker compose will consider the first element of the command array as the command name (including the spaces etc.). 从错误消息中,docker compose会将命令数组的第一个元素视为命令名称(包括空格等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM