Why does the container created with – 'docker run -d alpine sleep infinity' goes into exited/stopped state?

I have nothing to execute inside a container but want it to be running. So, I tried to create a container using the following command line – 'docker run -d alpine sleep infinity'. But, instead, it is going into a exited/stopped state immediately. What’s the explanation?

  • OSX Docker/WordPress/MySQL — Connection Error: (1130) Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MariaDB server
  • Docker: how to to get access to interactive mode once server started in foreground?
  • Docker Namespace in kernel level
  • How do I connect to a server running in a Docker container?
  • how to enable docker remote api on windows-10
  • why does kafka docker need to listen on unix socket
  • Rancher external subdomains
  • Docker container can't see a serialport device
  • how to change cassandra docker config
  • Gunicorn is stuck on docker run command with a Flask Application
  • docker service create doesn't find image
  • How can I copy the files to be in executing directory using Dockerfile?
  • One Solution collect form web for “Why does the container created with – 'docker run -d alpine sleep infinity' goes into exited/stopped state?”

    alpine is busybox-based, and doesn’t provide the full array of options and extensions available in GNU tools; infinity as an option to sleep is an example of something that’s unavailable.

    Consider instead:

    docker run -d alpine sh -c 'while sleep 3600; do :; done'
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.