SSLPeerUnverifiedException: Hostname not verified

The final architecture is expected to have the following deployment option: a system for storing source code and version control based on Gitlab, an automated build system based on Gitlab Runner and a code analysis system based on SonarQube.
We created two hosts to test the operability of this solution: first has a SonarQube as a docker container, second has GitLab also as a container.
When we try to add SonarQube CI-integration with GitLab, the following error occurs: “ Hostname not verified”, so SonarQube can’t load Gitlab projects and can’t be called from the CI-pipeline.
The GitLab certificate is self-signed, but it was added to the trusted list both at the level of OS and in the SonarQube container. The certificate was also added to the keystore cacerts to exclude the possible influence of Java. The certificate is valid and not expired. The hostname of the GitLab container, the CN of the certificate, and the hostname requested from the SonarQube are the same.
The GitLab API works correctly, there should be no network problems, because we receive data, when we test requests with curl from the SonarQube container.
How can we localize the problem? What are the possible solutions in this situation?