简体   繁体   中英

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:

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:

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.

However if I start the container from the CLI with the same command it works perfectly.

What actually happens under the hood and how can I make this work ?

Linux version of the container is: 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

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.).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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