Hands-On Docker for Microservices with Python
上QQ阅读APP看书,第一时间看更新

Build, Run, and Test Your Service Using Docker

Having designed a working RESTful microservice in the previous chapter, we'll see in this chapter how to use it in the Docker way, encapsulating the service into a self-contained container so that it's immutable and can be deployed on its own. This chapter describes very explicitly the dependencies of the service and the ways it can be used. The main way to run a service is to run it as a web server, but other operations are possible, such as running unit tests, generating reports, and others. We'll see also how to deploy the service on your local computer for testing and how to share it through an image repository.

The following topics will be covered in this chapter:

  • Building your service with a Dockerfile
  • Operating with an immutable container
  • Configuring your service
  • Deploying the Docker service locally
  • Pushing your Docker image to a remote registry

By the end of the chapter, you'll know how to operate with Docker, create a basic service, build an image, and run it. You'll also know how to share the image to be run on another computer.