Skip to content
Advertisement

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

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement