Ideal way to handle docker login and logout with concurrent docker builds

Hi,
I am trying to achieve something like below concurrently (e.g. with Jenkins job, multiple jobs running concurrently on same agent),

  1. Concurrently building multiple Windows image
  2. Logging in to private registry to fetch base image
  3. Logout once image build is done for given job

For concurrent jobs, docker logout is taking back access of another job which is still in building stage, causing build failures.

What can be the best approach to handle this situation ?