3 Publishing your first microservice

 

This chapter covers

  • Differences between images and containers
  • Using Docker in the development environment
  • Packaging and publishing your microservice as a Docker image
  • Creating a private container registry
  • Instantiating your microservice in a container

By the end of this book, we’ll have deployed multiple microservices to our production environment: a Kubernetes cluster. But before we can deploy an entire microservices application, we must first be able to package and publish a single microservice! In this chapter, we’ll take the video-streaming microservice we created in chapter 2 and publish it so that it’s ready for deployment to our cluster.

To deploy a microservice to a cluster running in the cloud, we have to publish it somewhere that’s accessible by the cluster. To achieve this, we must first package our code, assets, and dependencies into a single bundle. We’ll then need a location in the cloud to host this package. For that, we’ll create a container registry. If you haven’t heard of containers yet, this will be explained soon.

3.1 New tool: Docker

3.2 Getting the code

3.3 What is a container?

3.4 What is an image?

3.5 Why Docker?

3.6 Why do we need Docker?

3.7 Adding Docker to our development environment

3.7.1 Installing Docker

3.7.2 Checking your Docker installation

3.8 Packaging our microservice

3.8.1 Creating a Dockerfile