Building the Docker Images
Note that, if you are developing on Linux, you may want to add your username to the docker Unix group.
The previous step (./gradlew build) generated JARs and Node.js modules that can be used to run the application locally, typically from an IDE. The present step will create Docker images that you can run locally, or push to your organization registry for further deployment, typically using Kubernetes.
In order to build the Docker images for the microservices in your application, use the following command in the root directory of your project:
./gradlew docker
As the result of this step, you should see that the following Docker images have been created.
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker-registry.internal.some-company.com/app/data-service 0.1.0-SNAPSHOT 65703bf554c9 About an hour ago 145MB docker-registry.internal.some-company.com/app/scenario-service 0.1.0-SNAPSHOT 2524e6f37093 About an hour ago 128MB docker-registry.internal.some-company.com/app/gateway-service 0.1.0-SNAPSHOT 6344f811024a About an hour ago 109MB docker-registry.internal.some-company.com/app/execution-service 0.1.0-SNAPSHOT c085834c35b2 About an hour ago 125MB docker-registry.internal.some-company.com/app/web 0.1.0-SNAPSHOT 0f2acf2301c7 About an hour ago 395MB docker-registry.internal.some-company.com/app/backend-service 0.1.0-SNAPSHOT a711c95d3488 About an hour ago 123MB docker-registry.internal.some-company.com/app/engine-worker 0.1.0-SNAPSHOT a711c95d3688 About an hour ago 123MB docker-registry.internal.some-company.com/app/checker-worker 0.1.0-SNAPSHOT a711c95d3842 About an hour ago 123MB
As mentioned in Section Pushing Docker Images:
-
The typical name of a Docker image is of the form
registry/optional-path/short-name:version. -
The
dockertask generates Docker images where theregistrypart of the image names is a dummy registry name. -
This registry name is controlled by the
DOCKER_PULL_REGISTRYvariable in the projectgradle.propertiesfile. -
Using a dummy registry name works without problems for testing the images locally.
-
If and when you want to publish the Docker images on a registry, you must change the value of the
DOCKER_PULL_REGISTRYvariable in the projectgradle.propertiesfile and running the./gradlew updateCode dockercommand.