August 2017
Intermediate to advanced
332 pages
9h 16m
English
In the preceding example, we had to first build the calculator image using the docker build command, and then it could be specified inside docker-compose.yml. There is also another approach to let Docker Compose build the image. In that case, we need to specify the build property instead of image in the configuration.
Let's put the docker-compose.yml file in the calculator project's directory. When Dockerfile and Docker Compose configurations are in the same directory, the former can look as follows:
version: "3"services: calculator: build: . ports: - 8080 redis: image: redis:latest
The docker-compose build command builds the image. We can also ask Docker Compose to build images before running the containers with the use of ...
Read now
Unlock full access