Creating Docker images with Visual Studio When you use Visual Studio to create a project with Docker support, you don’t explicitly create an
image. Instead, the image is created for you when you press F5 (or Ctrl+F5) to run the dockerized
application or service. This step is automatic in Visual Studio and you won’t see it happen, but it’s
important that you know what’s going on underneath.
Step 4. Define your services in docker-compose.yml when building a multi-container Docker application The
docker-compose.yml
file lets you define a set of related services to be deployed as a composed
application with deployment commands. It also configures its dependency relations and runtime
configuration.
To use a docker-compose.yml file, you need to create the file in your main or root solution folder, with
content similar to that in the following example:
version:
'3.4'
services:
webmvc:
image:
eshop/web
environment:
- CatalogUrl=http:
//catalog-api
- OrderingUrl=http:
//ordering-api
ports:
- "80:80"
depends_on:
- catalog-api
- ordering-api
catalog-api:
image:
eshop/catalog-api
environment:
- ConnectionString=Server=sqldata;Port=1433;Database=CatalogDB;…
ports:
- "81:80"
depends_on:
- sqldata
ordering-api:
image:
eshop/ordering-api
environment:
- ConnectionString=Server=sqldata;Database=OrderingDb;…
ports:
- "82:80"
extra_hosts:
- "CESARDLBOOKVHD:10.0.75.1"
depends_on:
85
CHAPTER 4 | Development process for Docker-based applications