Fix race condition during socket creation

Docker-DCO-1.1-Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> (github: glebfm)
Merge pull request #5947 from glebfm/fix-socket-race-condition

Fix race condition during socket creation