@Override public void copyToContainer(InputStream tarStream, String containerId, String path) throws DockerException, InterruptedException { final WebTarget resource = resource() .path("containers") .path(containerId) .path("archive") .queryParam("noOverwriteDirNonDir", true) .queryParam("path", path); try { request(PUT, String.class, resource, resource.request(APPLICATION_OCTET_STREAM_TYPE), Entity.entity(tarStream, "application/tar")); } catch (DockerRequestException e) { switch (e.status()) { case 400: throw new BadParamException(getQueryParamMap(resource), e); case 403: throw new PermissionException("Volume or container rootfs is marked as read-only.", e); case 404: throw new NotFoundException( String.format("Either container %s or path %s not found.", containerId, path), e); default: throw e; } } }
@Override public void copyToContainer(InputStream tarStream, String containerId, String path) throws DockerException, InterruptedException { final WebTarget resource = resource() .path("containers") .path(containerId) .path("archive") .queryParam("noOverwriteDirNonDir", true) .queryParam("path", path); try { request(PUT, String.class, resource, resource.request(APPLICATION_OCTET_STREAM_TYPE), Entity.entity(tarStream, "application/tar")); } catch (DockerRequestException e) { switch (e.status()) { case 400: throw new BadParamException(getQueryParamMap(resource), e); case 403: throw new PermissionException("Volume or container rootfs is marked as read-only.", e); case 404: throw new NotFoundException( String.format("Either container %s or path %s not found.", containerId, path), e); default: throw e; } } }