A docker containing not running anything particular in the foreground will exit immediately after start.
/bin/sh as the startup command does not help. Some Internet sources suggest
tail -f /dev/null, and it works, but such container cannot be stopped gracefully. The best solution I could find was a shell script running a wait loop:
# Dockerfile FROM alpine CMD while true; do sleep 1000; done
This takes a few seconds to stop gracefully, but it does go down eventually.