Exercise: Using docker-compose to deploy the FSE application
The aim of this exercise is to deploy the Festival Search Engine application on Docker containers. Each module of the application will be deployed on a specific container: mongo, backend and frontend.
We will use the docker-compose command of Docker to deploy the FSE application.
The zipped file provided at the end of this page contains:
- two folders, backend and frontend, which contain the Dockerfile of the two corresponding modules.
- a yaml file: fse-compose.yaml which describes the workflow (how the three modules are "linked": port, IP addresses) and the virtual network infrastructure on which the application is deployed.
The yaml file is used by docker-compose to deploy the application.
Structure of the Yaml file
The first section - services section - describes the three containers (services): mongo, backend and frontend modules:
This container relies on the last version of the mongo image (Docker repository).
"expose" informs Docker that the container listens on the specified network ports at runtime. "expose" does not make the ports of the container accessible to the host.
In other words, "expose" opens the port in the container, making it accessible by other containers.
The second service describes the backend module:
When deployed, this container will have the private address: 10.5.0.6 and will listen on port 3000.
The third service describes the frontend module:
The "ports" option establishes a link between a container port and a host port, making the container port accessible from the host.
"command" provides the arguments to pass to the Docker ENTRYPOINT command (see Dockerfile file)
The last section of the fse-compose.yaml file (networks section) describes the virtual network on top of which the three containers will be deployed:
- subnet: 10.5.0.0/16
To deploy the application, type : docker-compose -f fse-compose.yml up
To access the FSE application, type: http://localhost:8080
- 14. Oktober 2019, 23:45