You can start a Docker container in detached mode with a -d option. It's the opposite of the foreground mode. The container starts up and runs in background, the same as a daemon or a service. Let's try to run our rest-example in the background, executing the following command:
$ docker run -d -p 8080:8080 rest-example
After the container starts, you will be given a control and can use a shell or command line for executing other commands. Docker will just output the container ID, as you can see on the following screenshot:
You can use the container ID to reference the container in other docker commands, for example, if you need to ...