How to connect to docker test evironment from maven test in the GitLab CI?

I wanted to implement an integration test in my Java Maven Spring-Boot application using my docker-compose setup. but when I try to connect to the gateway service from my setup that is active in the docker environment, then I get the following error:
java.net.ConnectException: Failed to connect to docker/172.17.0.3:4000.

and if I try to use localhost instead of docker I get this error:
java.net.ConnectException: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4000.

does anyone have any idea what I could try to solve this issue?

here is the code that tries to connect to the gateway docker container:

    public Response sendHTTPMessage(String uri, RequestBody body, HTTPMethods method) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder().build();
        Request request = new Request.Builder()
                .url("http://docker:4000" + uri)
                .method(method.value(), body)
                .addHeader("Content-Type", "application/json")
                .addHeader("Authorization", (this.token == null ? "" : "Bearer " + this.token))
                .build();

        return client.newCall(request).execute();
    }

here is my project repo with the GitLab-ci and docker-compose files that I use to set up the test environment (I use the default shared GitLab runners): https://gitlab.com/kwetter_jack/Kwetter_posts/-/tree/test_integration/

here are the main log files of my failed attempts (the error is at the bottom of the log file)
log of the localhost URL test
log of the docker URL test