public void dockerLogin(ImageRegistry imageRegistry) throws HyscaleException {
        if (StringUtils.isBlank(imageRegistry.getToken())) {
            return;
        }
        Credentials credentials = EncodeDecodeUtil.getDecodedCredentials(imageRegistry.getToken());
        if (credentials == null) {
            return;
        }
        logger.debug("Docker login to registry: {}", imageRegistry.getUrl());
        String loginCommand = commandGenerator.dockerLogin(imageRegistry.getUrl(), credentials.getUsername(),
                credentials.getPassword());
        boolean success = CommandExecutor.execute(loginCommand);
        if (!success) {
            throw new HyscaleException(ImageBuilderErrorCodes.FAILED_TO_LOGIN, imageRegistry.getUrl());
        }
    }
Test if docker is installed and docker daemon is running
image-builder/builder-services/src/main/java/io/hyscale/builder/services/util/DockerImageUtil.java