117
CHAPTER 5 | Designing and Developing Multi-Container and Microservice-Based .NET Applications
Basically, you define each of the containers you want to deploy plus certain characteristics for each
container deployment. Once you have a multi-container deployment description file, you can deploy
the whole solution in a single action orchestrated by the
docker-compose up
CLI command, or you
can deploy it transparently from Visual Studio. Otherwise, you would need to use the Docker CLI to
deploy container-by-container in multiple steps by using the
docker run
command from the
command line. Therefore, each service defined in docker-compose.yml must specify exactly one
image or build. Other keys are optional, and are analogous to their
docker run
command-line
counterparts.
The following YAML code is the definition of a possible global but single docker-compose.yml file for
the eShopOnContainers sample. This code is not the actual docker-compose file from
eShopOnContainers. Instead, it is a simplified and consolidated version in a single file, which is not the
best way to work with docker-compose files, as will be explained later.
version:
'3.4'
services:
webmvc:
image:
eshop/webmvc
environment:
Dostları ilə paylaş: