Run ratings in Docker

    This module shows how you create a image and run it locally.

    1. Download the for the ratings microservice.

    2. Observe the Dockerfile.

      1. $ cat Dockerfile
    3. Create an environment variable to store your user id which will be used to tag the docker image for ratings service. For example, .

    4. Build a Docker image from the Dockerfile:

      1. ...
      2. Step 9/9 : CMD node /opt/microservices/ratings.js 9080
      3. ---> Using cache
      4. ---> 77c6a304476c
      5. Successfully built 77c6a304476c
    5. Run ratings in Docker. The following command instructs Docker to expose port of the container to port 9081 of your computer, allowing you to access the ratings microservice on port 9081.

      1. $ curl localhost:9081/ratings/7
      2. {"id":7,"ratings":{"Reviewer1":5,"Reviewer2":4}}
    6. Observe the running container. Run the docker ps command to list all the running containers and notice the container with the image <your user name>/ratings.

    You have learned how to package a single service into a container. The next step is to learn how to .