'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



Solution 1:[1]

command: ["tail", "-f", "/dev/null"]

in docker-compose.yml This worked for me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ananta R. Pant