September 2019
Intermediate to advanced
668 pages
15h 59m
English
Okay, that was great, but what if we don't want to hang the Terminal windows from where we started the container?
It's time to start the container as detached, that is, running the container without locking Terminal!
We can do this by adding the -d option and at the same time giving it a name using the --name option. The --rm option is no longer required since we will stop and remove the container explicitly when we are done with it:
docker run -d -p8080:8080 -e "SPRING_PROFILES_ACTIVE=docker" --name my-prd-srv product-service
If we run the docker ps command again, we will see our new container, called my-prd-srv:
But how do we get the log output from our container?
Meet the Docker logs command:
docker logs ...