private void doValidate() {
        List<String> errors = new ArrayList<>();
        // Strip off user from repository name
        String image = user != null ? repository.substring(user.length() + 1) : repository;
        Object[] checks = new Object[] {
            "registry", DOMAIN_REGEXP, registry,
            "image", IMAGE_NAME_REGEXP, image,
            "user", NAME_COMP_REGEXP, user,
            "tag", TAG_REGEXP, tag,
            "digest", DIGEST_REGEXP, digest
        };
        for (int i = 0; i < checks.length; i +=3) {
            String value = (String) checks[i + 2];
            Pattern checkPattern = (Pattern) checks[i + 1];
            if (value != null &&
                !checkPattern.matcher(value).matches()) {
                errors.add(String.format("%s part '%s' doesn't match allowed pattern '%s'",
                                         checks[i], value, checkPattern.pattern()));
            }
        }
        if (errors.size() > 0) {
            StringBuilder buf = new StringBuilder();
            buf.append(String.format("Given Docker name '%s' is invalid:\n", getFullName()));
            for (String error : errors) {
                buf.append(String.format("   * %s\n",error));
            }
            buf.append("See http://bit.ly/docker_image_fmt for more details");
            throw new IllegalArgumentException(buf.toString());
        }
    }
Check whether the given name validates agains the Docker rules for names

@param image image name to validate
d@throws IllegalArgumentException if the name doesnt validate
src/main/java/io/fabric8/maven/docker/util/ImageName.java