Skip to content

Creating Docker containers for Microservices with docker-compose

Notifications You must be signed in to change notification settings

paritosh64ce/microservice-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Motivation:

To deploy existing .Net Core 3.1 microservices as docker containers; using docker-compose (manually created) spinning all microservices up.

Prerequisites

  • Docker Desktop 4.14.1 (91661)
  • Visual Studio 2019/2022

Intructions

  • Start Docker Desktop

  • Execute below command from commands prompt from the root directory

    docker-compose build
    docker-compose up

    Once done, clear the containers with below command

    docker-compose down
  • Note: While working with SQL DB in docker image for the very first time,

Branches:

  • sql-image: The DBs are hosted in mcr.microsoft.com/mssql/server:2019-latest container; mounted in local filesystem
  • TODO: az-sql: The DBs are hosted in Azure SQL DBs

Dev Notes:

Issues encountered:

  • Issue 1: Failed to compute cache key: ".csproj" not found while running docker-compose build,

  • Issue 2: ...then an error occurred during the pre-login handshake.

  • Issue 3: Discount MS URL showing can't reach this page http://localhost:5007/api/discount/code/Awesome

  • Issue 4: Can't reach sql.discount DB from SSMS (outside of api.discount docker container)

  • Issue 5: Font files not getting loaded

    Failed to load resource: the server responded with a status of 404 (Not Found) OpenSans-Bold.ttf:1
    Failed to load resource: the server responded with a status of 404 (Not Found) OpenSans-Regular.ttf:1

    • The file names are case-sensitive in linux based OS/docker-images. Updating the names properly in CSS fixes this issue.

Done:

  • Use mssql server container for database and mount volumn
  • Start other services with DB dependencies and start using Az Message Bus
  • Provide config details from compose env file
  • Fixed errors in Payment & Marketing microservices

TODO:

  • Use docker-compose.override.yml

  • Configure application to use https: Reference: https://medium.com/@woeterman_94/docker-in-visual-studio-unable-to-configure-https-endpoint-f95727187f5f

  • Use JWT and OpenAuth

  • Error at the time of placing the order Something went wrong placing your order. Please try again.

  • docker-compose -f "F:\GitHub\microservice-compose\docker-compose.yml" -f "F:\GitHub\microservice-compose\docker-compose.override.yml" -f "F:\GitHub\microservice-compose\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose3401452746285916942 --ansi never up -d --no-build

  • docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d

  • docker-compose -f docker-compose.yml -f docker-compose.override.yml

About

Creating Docker containers for Microservices with docker-compose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published