private void configureExternalPorts() {
        logger().debug("Mapping external ports to the alternate address configuration");

        final FormBody.Builder builder = new FormBody.Builder();
        builder.add("hostname", getHost());
        builder.add("mgmt", Integer.toString(getMappedPort(MGMT_PORT)));
        if (hasTlsPorts) {
            builder.add("mgmtSSL", Integer.toString(getMappedPort(MGMT_SSL_PORT)));
        }

        if (enabledServices.contains(CouchbaseService.KV)) {
            builder.add("kv", Integer.toString(getMappedPort(KV_PORT)));
            builder.add("capi", Integer.toString(getMappedPort(VIEW_PORT)));
            if (hasTlsPorts) {
                builder.add("kvSSL", Integer.toString(getMappedPort(KV_SSL_PORT)));
                builder.add("capiSSL", Integer.toString(getMappedPort(VIEW_SSL_PORT)));
            }
        }

        if (enabledServices.contains(CouchbaseService.QUERY)) {
            builder.add("n1ql", Integer.toString(getMappedPort(QUERY_PORT)));
            if (hasTlsPorts) {
                builder.add("n1qlSSL", Integer.toString(getMappedPort(QUERY_SSL_PORT)));
            }
        }

        if (enabledServices.contains(CouchbaseService.SEARCH)) {
            builder.add("fts", Integer.toString(getMappedPort(SEARCH_PORT)));
            if (hasTlsPorts) {
                builder.add("ftsSSL", Integer.toString(getMappedPort(SEARCH_SSL_PORT)));
            }
        }

        if (enabledServices.contains(CouchbaseService.ANALYTICS)) {
            builder.add("cbas", Integer.toString(getMappedPort(ANALYTICS_PORT)));
            if (hasTlsPorts) {
                builder.add("cbasSSL", Integer.toString(getMappedPort(ANALYTICS_SSL_PORT)));
            }
        }

        if (enabledServices.contains(CouchbaseService.EVENTING)) {
            builder.add("eventingAdminPort", Integer.toString(getMappedPort(EVENTING_PORT)));
            if (hasTlsPorts) {
                builder.add("eventingSSL", Integer.toString(getMappedPort(EVENTING_SSL_PORT)));
            }
        }

        @Cleanup
        Response response = doHttpRequest(
            MGMT_PORT,
            "/node/controller/setupAlternateAddresses/external",
            "PUT",
            builder.build(),
            true
        );

        checkSuccessfulResponse(response, "Could not configure external ports");
    }
Configures the external ports for SDK access.
<p>
Since the internal ports are not accessible from outside the container, this code configures the "external"
hostname and services to align with the mapped ports. The SDK will pick it up and then automatically connect
to those ports. Note that for all services non-ssl and ssl ports are configured.
modules/couchbase/src/main/java/org/testcontainers/couchbase/CouchbaseContainer.java