I have a function that builds a connection to a docker. You don't really need to understand much but all I want is to make sure the IP and port is always the same as in my app (Settings.getSettings())

```
 public static DockerClient dockerClient() {

    try {

        Settings settings = Settings.getSettings();
        DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
                .withDockerHost("tcp://" + settings.getDockerIP() + ":" + settings.getDockerPort())
                .withDockerConfig("/home/user/.docker/config.json")
                .build();

        DockerCmdExecFactory dockerCmdExecFactory = new JerseyDockerCmdExecFactory()
                .withMaxTotalConnections(200)
                .withMaxPerRouteConnections(200);

        DockerClient dockerClient = DockerClientBuilder.getInstance(config)
                .withDockerCmdExecFactory(dockerCmdExecFactory)
                .build();

        return dockerClient;

    } catch (Exception e) {
        System.out.println("Error: " + e);
    }
    return null;
}

```

And everytime I want to do something I'm calling this function. Example:

```
public static void startContainer(String containerName) {
    DockerClient dockerClient = dockerClient();
 ....
  public static List<Image> getImages() {
    List<Image> images = new ArrayList<>(dockerClient().listImagesCmd().withShowAll(true).exec());
 ....

```

**Isn't there a more efficient way to handle this?** I just want to make sure that when i execute some command, the connection to the right ip and port is made.