简体   繁体   中英

Jersey UniformInterfaceException when doing a POST with docker-client

When trying to post a RESTful Service via docker-client to my private docker registry i get that error. The confusing thing about that is that the input stream changes itself as you can see here. Its made somewhere in the background of jersey but i cannot find the cause for it. I guess the problem occurs somewhere inside the jersey logic

Method

public static Service initService(String imageId) {

        final com.spotify.docker.client.DockerClient docker = new DefaultDockerClient(
                "http://10.###.###.143:2375");
        String s = null;

        try {

            s = ("10.###.###.143:5000/user/ipatest&tag=latest");

            docker.pull(s);

            System.out.println(docker.toString());

        } catch (DockerException | InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

Exception

com.spotify.docker.client.DockerRequestException: Request error: POST http://10.###.###.143:2375/v1.12/images/create?fromImage=10.###.###.143%3A5000%2Fuser%2Fipatest%26tag%3Dlatest: 500
            at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:563)
            at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:544)
            at com.spotify.docker.client.DefaultDockerClient.pull(DefaultDockerClient.java:345)
            at com.spotify.docker.client.DefaultDockerClient.pull(DefaultDockerClient.java:329)
            at de.fhg.ipa.vfk.eapps.commoniaas.docker.DockerServiceMgmt.initService(DockerServiceMgmt.java:43)
            at de.fhg.ipa.vfk.eapps.commoniaas.docker.DockerServiceMgmt.main(DockerServiceMgmt.java:163)
        Caused by: com.sun.jersey.api.client.UniformInterfaceException: POST http://10.###.###.143:2375/v1.12/images/create?fromImage=10.###.###.143%3A5000%2Fuser%2Fipatest%26tag%3Dlatest returned a response status of 500 Internal Server Error
            at com.sun.jersey.api.client.WebResource.handle(WebResource.java:688)
            at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
            at com.sun.jersey.api.client.WebResource$Builder.method(WebResource.java:623)
            at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:540)
            ... 4 more

It must have something to do with queryParams(String params) which belongs to WebResource (jersey)

The image name you're passing to pull isn't valid. The format for an image name is name:tag . Do this instead:

docker.pull("10.###.###.143:5000/user/ipatest:latest");

Alternatively, you can ommit the :latest , since it is implied when no other tag is specified.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM