To keep a container running in the background, supply the -d
command line option during container startup:
docker run -d busybox top
The option -d
runs the container in detached mode. It is also equivalent to -d=true
.
A container in detached mode cannot be removed automatically when it stops, this means one cannot use the --rm option in combination with -d option.