Docker Community Forums

Share and learn in the Docker community.

How to pull docker image from private registry to the open shift cluster under image streams using using fabric8 java client

I am trying to pull a docker image from my private repository using fabric8 docker client for java.

The secret and image stream gets created on the open shift cluster but the image count shown as 0 as the image does not get pulled from the private repository .

This is my code . Please suggest to pull the image from private repo(abc/hello-world) …

public boolean createImageStream(String token, ImageStreamRequest imageStreamRequest) throws BaseExceptionBean{"----- creatImageStream started STARTED --");
        try {
          final String namespace;
         final User user = new User(imageStreamRequest.getUserName());
          String secretName = null;
          OpenShiftClient userClient = createOpenShiftClient(user);
          namespace = imageStreamRequest.getNameSpace(imageStreamRequest.getUserName()) ;
"Using configured namespace: {}", namespace);
         // secretName = resolveSecret(userClient, namespace, imageStreamRequest);
          final boolean secretSuccess = createOrUpdateSecret(imageStreamRequest, userClient);
            if (!secretSuccess) {
      "Error Creating secret for User:{}", user.getUserName());
          TagReference pol = new TagReference();
          pol.setReferencePolicy(new TagReferencePolicy("Local"));
          final ImageStream imageStream = userClient.imageStreams().inNamespace(namespace).createOrReplace(new ImageStreamBuilder()

"Created image stream: {}", imageStream.getMetadata().getName());
        } catch (final Exception ex){
            LOGGER.error("Exception occurred while creating ImageStream:" +ex.getMessage());
            throw new SystemException(ErrorMessageConstant.errorPrefix + ErrorMessageConstant.CODE_4009_MSG,
                    ErrorMessageConstant.CODE_4009_MSG, new Date(), ex.getMessage(), SystemException.SYSTEM.OPENSHIFT);

       return true;