Follow logs untill given expression matches with Docker

I have an CI Deploy Script in Bamboo running to deploy my Web-App via docker-compose with the following setup:

  • db
  • redis
  • elastic
  • web-app

The Web-App Container includes two applications.

  1. The Web-App itself
  2. And the Migration.exe to apply Data-Base / Filesystem changed

I got a few migration that take longer, as they import data.
Problem is the migration.exe is inside the entry-point script:

  1. Run Migration.exe
  2. If successfull run dotnet core web app

That said the deploy script launches the next task ("change-web-host") to point to the new environment which is not available until migration.exe finished.

My goal is to put a second task between the docker-compose up -d task and the Change Webhost Task to follow the log and print it untill "Web-Application successfully started" is written to stdout/err.

I cant just wait to finish the log cause the web-app will write also to this.

Also I cant run the migration in the built process since I need the mounted folders (which are not available there).

Source: Windows Questions