Skip to Content
Hands-On Microservices with Spring Boot and Spring Cloud
book

Hands-On Microservices with Spring Boot and Spring Cloud

by Magnus Larsson
September 2019
Intermediate to advanced
668 pages
15h 59m
English
Packt Publishing
Content preview from Hands-On Microservices with Spring Boot and Spring Cloud

Running the container detached

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Master Microservices with Spring Boot and Spring Cloud

Master Microservices with Spring Boot and Spring Cloud

In28Minutes Official

Publisher Resources

ISBN: 9781789613476Supplemental Content