dmandalidis / docker-client Goto Github PK
View Code? Open in Web Editor NEWA simple docker client for the JVM
License: Apache License 2.0
A simple docker client for the JVM
License: Apache License 2.0
Is this a BUG REPORT or FEATURE REQUEST?:
Feature Request
We are trying to use your SDK for running Tomcat application on RHEL 8. Unfortunately, RedHat 8.x doesn't support traditional Docker (thus docker daemon) running; it uses something called podman instead. Any thoughts on if this Java SDK can be used in this scenario??
[Add steps on how to reproduce this issue]
[Describe what do you expect to happen]
[Describe the actual results]
docker version
: [Add the output of docker version
here, both client and server][Paste full backtrace here]
Is this a BUG REPORT or FEATURE REQUEST?:
BUG REPORT
"A note on shading" is still present in the TOC at top of README.md. The content was removed in #169.
Trying to use 2.0.2 unshaded and getting the following error. In my Tomcat home/lib, I have jaxb-api.jar file, but seems the Docker client is trying to use jakarta.xml.bind-api-2.3.2.jar??
26-Nov-2019 09:47:32.537 SEVERE [RMI TCP Connection(3)-127.0.0.1] com.sun.jersey.server.impl.wadl.WadlApplicationContextImpl.<init> Provider class com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/software/tomcat9026/lib/jaxb-api.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/software/tomcat9026/webapps/arcgis%23rest/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/JAXBContext.class. Please make sure that you are specifying the proper ClassLoader.
javax.xml.bind.JAXBException: Provider class com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/software/tomcat9026/lib/jaxb-api.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/software/tomcat9026/webapps/arcgis%23rest/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/JAXBContext.class. Please make sure that you are specifying the proper ClassLoader.
- with linked exception:
[javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/software/tomcat9026/lib/jaxb-api.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/software/tomcat9026/webapps/arcgis%23rest/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/JAXBContext.class. Please make sure that you are specifying the proper ClassLoader. ]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:202)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:129)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:307)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:478)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:435)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:336)
at com.sun.jersey.server.impl.wadl.WadlApplicationContextImpl.<init>(WadlApplicationContextImpl.java:107)
at com.sun.jersey.server.impl.wadl.WadlFactory.init(WadlFactory.java:100)
at com.sun.jersey.server.impl.application.RootResourceUriRules.initWadl(RootResourceUriRules.java:169)
at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:106)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1359)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:744)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:102)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4533)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5172)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1728)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at java.management/com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/software/tomcat9026/lib/jaxb-api.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/software/tomcat9026/webapps/arcgis%23rest/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/JAXBContext.class. Please make sure that you are specifying the proper ClassLoader.
at javax.xml.bind.ContextFinder.handleClassCastException(ContextFinder.java:111)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:187)
... 71 more
FEATURE REQUEST:
Support --update-order
from Docker API v1.29
(https://docs.docker.com/engine/api/v1.29/#operation/ServiceUpdate)
STILL INVESTIGATING ON MY SIDE
Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT
As suggested here
Shaded jar is not working as expected.
DockerClient dc;
Version v;
Builder builder = DefaultDockerClient.fromEnv();
builder = builder.readTimeoutMillis(500);
dc = builder.build();
v = dc.version();
The call to dc.version() returns a value
The call to dc.version() throws an exception:
org.mandas.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: org.mandas.docker.client.shaded.javax.ws.rs.ProcessingException: java.lang.UnsatisfiedLinkError: could not load FFI provider org.mandas.docker.client.shaded.jnr.ffi.provider.jffi.Provider
docker version
:Server:
Engine:
Version: 18.09.7
API version: 1.39 (minimum version 1.12)
Go version: go1.10.1
Git commit: 2d0083d
Built: Wed Aug 14 19:41:23 2019
OS/Arch: linux/amd64
Experimental: false
Is this a BUG REPORT or FEATURE REQUEST?: FEATURE REQUEST
As of Docker 19.0.3, there is a new option to specify GPU capabilities during docker run
. It would be nice to include that here.
https://docs.docker.com/config/containers/resource_constraints/
--gpus gpu-request GPU devices to add to the
container ('all' to pass all GPUs)
Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT
First of all thank you for keeping this project alive!
I'm using SpringBoot 2.1.0 for Rest Services and therefore i have to use the shaded version of the library. However as soon as I start my application, there is immediately a java.lang.ClassNotFoundException
thrown with the message org.mandas.docker.client.shaded.javax.ws.rs.core.Configurable
.
This never happened before when using the spotify version. The last spotify version i used was: com.spotify:docker-client:8.14.5:shaded
.
Thanks for any help!
@Service
public class BasicDockerClientService {
private DockerClient docker;
public BasicDockerClientService(){
docker = DefaultDockerClient.fromEnv().build();
}
public DockerClient getDocker() {
return this.docker;
}
}
@RestController
@CrossOrigin
public class MyController {
@Autowired
BasicDockerClientService dockerService;
...
}
I would expect that the application starts by creating a new instance of DockerClient
.
java.lang.NoClassDefFoundError: org/mandas/docker/client/shaded/javax/ws/rs/core/Configurable
was thrown
docker version
:Client: Docker Engine - Community
Version: 19.03.1
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89e8a
Built: Thu Jul 25 21:21:35 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.1
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89e8a
Built: Thu Jul 25 21:20:09 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
org.mandas:docker-client:2.0.0:shaded
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'evaluationsController': Unsatisfied dependency expressed through field 'evaluationsDockerService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'evaluationsDockerService': Unsatisfied dependency expressed through field 'dockerClientService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainDockerClientService': Unsatisfied dependency expressed through field 'basicDockerClientService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basicDockerClientService' defined in file [/home/ivan/code/eaasy/eaasy-swarm-backend-api/bin/main/ch/hevs/medgift/eaasy/swarmbackend/docker/BasicDockerClientService.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [ch.hevs.medgift.eaasy.swarmbackend.docker.BasicDockerClientService]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/mandas/docker/client/shaded/javax/ws/rs/core/Configurable
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at ch.hevs.medgift.eaasy.swarmbackend.EaasySwarmBackendApplication.main(EaasySwarmBackendApplication.java:10) [main/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'evaluationsDockerService': Unsatisfied dependency expressed through field 'dockerClientService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainDockerClientService': Unsatisfied dependency expressed through field 'basicDockerClientService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basicDockerClientService' defined in file [/home/ivan/code/eaasy/eaasy-swarm-backend-api/bin/main/ch/hevs/medgift/eaasy/swarmbackend/docker/BasicDockerClientService.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [ch.hevs.medgift.eaasy.swarmbackend.docker.BasicDockerClientService]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/mandas/docker/client/shaded/javax/ws/rs/core/Configurable
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 19 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainDockerClientService': Unsatisfied dependency expressed through field 'basicDockerClientService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basicDockerClientService' defined in file [/home/ivan/code/eaasy/eaasy-swarm-backend-api/bin/main/ch/hevs/medgift/eaasy/swarmbackend/docker/BasicDockerClientService.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [ch.hevs.medgift.eaasy.swarmbackend.docker.BasicDockerClientService]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/mandas/docker/client/shaded/javax/ws/rs/core/Configurable
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 32 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basicDockerClientService' defined in file [/home/ivan/code/eaasy/eaasy-swarm-backend-api/bin/main/ch/hevs/medgift/eaasy/swarmbackend/docker/BasicDockerClientService.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [ch.hevs.medgift.eaasy.swarmbackend.docker.BasicDockerClientService]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/mandas/docker/client/shaded/javax/ws/rs/core/Configurable
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1270) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1164) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 45 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [ch.hevs.medgift.eaasy.swarmbackend.docker.BasicDockerClientService]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/mandas/docker/client/shaded/javax/ws/rs/core/Configurable
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1262) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 56 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/mandas/docker/client/shaded/javax/ws/rs/core/Configurable
at ch.hevs.medgift.eaasy.swarmbackend.docker.BasicDockerClientService.<init>(BasicDockerClientService.java:27) ~[main/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_222]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_222]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_222]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_222]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 58 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.mandas.docker.client.shaded.javax.ws.rs.core.Configurable
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_222]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_222]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_222]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_222]
... 64 common frames omitted
It seems there is an issue to jersey versions > 2.28. We have a test at DefaultDockerClientTest#testBuildInterruption
which constantly fails with jersey > 2.28 for no obvious (to me reason). I 've placed several log stmts to see what happens and it seems that somehow there's a huge delay between shutting down the executor and have the callable throw an InterruptedException
(more than 40-50s). I think it's something which broke in Jersey AsyncInvoker
but I cannot be sure since I 've never used Jersey before and requires much more time to investigate.
Removing the test is considered since there's no guarantee that an executor's tasks are cancelled (cancelled on a best-effort basis), but I 'd like to give it a try.
Why would someone need to use this project's shaded version? What are the problems otherwise?
Docker API documentation states that:
Both cases are not handled by the existing docker-client codebase
I am switching my code from using the com.spotify version to this version and hostBuild.appendBinds() is no longer a method? Thoughts?
// Set the binds on the container configuration
for (String srcPath : mapOfDirBinds.keySet()) {
logger.debug("Binding container to directory path: " + srcPath + " --> " + mapOfDirBinds.get(srcPath));
if (!StringUtils.isEmpty(samplesData) && srcPath.equalsIgnoreCase(samplesData)) {
// Mount samples data as readonly
hostBuilder.appendBinds(HostConfig.Bind.from(srcPath)
.to(mapOfDirBinds.get(srcPath))
.readOnly(true)
.build());
} else {
hostBuilder.appendBinds(srcPath + ":" + mapOfDirBinds.get(srcPath));
}
Hi @dmandalidis, when using the Docker-client, I see this a lot. Do you know if your PR #69 would help address these stack traces? It seems trying to read Docker logs has been problematic for quite some time.
java.lang.RuntimeException: java.io.IOException: Connection reset by peer at com.spotify.docker.client.shaded.com.google.common.base.Throwables.propagate(Throwables.java:240) at com.spotify.docker.client.DefaultLogStream.computeNext(DefaultLogStream.java:58) at com.spotify.docker.client.DefaultLogStream.computeNext(DefaultLogStream.java:35) at com.spotify.docker.client.shaded.com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:145) at com.spotify.docker.client.shaded.com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:140) at com.spotify.docker.client.DefaultLogStream.readFully(DefaultLogStream.java:77) at com.esri.arcgis.turing.admin.system.ContainersManager.launchContainer(ContainersManager.java:248) at ....
FEATURE REQUEST
Problem
Without setting no_new_priv bit in kernel, a process can gain additional privileges for example via suid or sgid bits. This way a lot of operations can become dangerous because of the possibility to subvert unprivileged binaries.
Common Weakness Enumeration
Solution
Restrict the container from acquiring additional privileges via suid or sgid bits.no_new_priv prevents LSMs like SELinux from transitioning to process labels that have access not allowed to the current process.
e.g.,
docker run --rm -it --security-opt=no-new-privileges ubuntu bash
N/A
Add the capability as a parameter or default to this behavior.
Thanks!
Hi @dmandalidis. Quick question as you are now my expert on this client SDK. :)
When I call docker.stats(containerId), it returns to me statistics and there is always about a 1-2 second wait time. This is equivalent to what you experience with the Docker CLI. However, with the Docker CLI, I am say docker stats
(meaning show stats for all containers) and this experiences the same 1-2 second wait time and then displays all containers and resource consumption.
With this SDK, only stats(containerId)
exists. The only way I know how to do this is loop over all the containers I have running and call it on each container. However, in this scenario, I experience the same 1-2 second delay but on each time it gets called. For a Docker environment running many containers (e.g. 50), this takes an excruciatingly long time.
Do you have any suggestions on how to improve this so that it behaves similar to the Docker CLI?
Below is my java code.
public JSONArray getAllContainerStatsLocal() throws AdminException {
DockerClient docker;
try {
docker = DefaultDockerClient.fromEnv().build();
} catch (DockerCertificateException e) {
logger.debug(e.getLocalizedMessage());
throw new AdminException(TuringAdminLogCode.FAILED_TO_ESTABLISH_DOCKER_ENVIRONMENT.message(), e);
}
try {
JSONArray array = new JSONArray();
ContainerStats stats = null;
Container[] cns = getAllContainersLocal(ServerIPUtil.getFQLocalHost());
for (int i = 0; i < cns.length; i++) {
stats = docker.stats(cns[i].getContainerId()); // <-- Slow line
ContainerStatistics cs = null;
if (stats != null) {
cs = createContainerStatisticsObject(stats, cns[i].getId(), cns[i].getContainerId());
array.put(cs.toJSON());
}
}
return array;
} catch (Exception e) {
logger.debug(e);
throw new AdminException(e);
} finally {
if (null != docker) {
docker.close();
}
}
}
The following methods need to perform calls without read timeout since their operation is blocking in a way that a container decides whether output should be sent back to caller.
Since the Docker API does not define a way for most of them to block for a specific time period, caller should block forever assuming that Docker behaves correctly.
These methods are:
Note that this bug affects 4.0.0 and onwards and slipped our attention towards supporting additional JAXRS clients.
https://nvd.nist.gov/vuln/detail/CVE-2019-14540
https://nvd.nist.gov/vuln/detail/CVE-2019-16335
https://nvd.nist.gov/vuln/detail/CVE-2019-14379
https://nvd.nist.gov/vuln/detail/CVE-2019-14439
https://nvd.nist.gov/vuln/detail/CVE-2019-12384
https://nvd.nist.gov/vuln/detail/CVE-2019-12814
https://nvd.nist.gov/vuln/detail/CVE-2019-12086
Is this a BUG REPORT or FEATURE REQUEST?:
FEATURE REQUEST
Docker SWARM nodes can advertise availability of generic resources, which can be requested by and used to constrain services. Support for specifying generic resources on Swarm service requests could support allocating GPU resources. This could be implemented by extending the ResourceRequirements type to include key-value pairs.
docker version
: Docker version 19.03.6A new endpoint was added in API v1.30 https://docs.docker.com/engine/api/v1.30/#tag/Distribution
It could be useful to have it to replicate the image pinning client side.
I have started to port one of our projects from Spotify's docker-client to your fork. We have the following piece of code:
@Override
protected HostConfig additionalHostConfig(HostConfig config) {
return config.toBuilder()
// Add some additional configuration here.
// Omitted the irrelevant details.
.build();
}
The idea is that we have a basic HostConfig which sub classes can extend with additional configuration options. This works with Spotify's docker-client but after using your fork toBuilder() returns an empty object instead of a pre-populated builder, i.e. the original configuration is lost. Looks like that this has been introduced when moving from autovalue to immutables.
On a side note, I also can't pass around HostConfig.Builder because this interface is not public.
HostConfig.builder()
.addSysctl("key", "value")
.build()
.toBuilder()
.build()
The code snippet above should return a HostConfig object with one entry for "sysctl".
The code snippet above returns an empty HostConfig object.
docker version
: 19.03.8-ce (both client and server)Is this a BUG REPORT or FEATURE REQUEST?: BUG
When calling DockerClient#logs a java.lang.NoSuchMethodError
with message java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer
is thrown. As of my current research, this seems to be a problem when compiling with Java > 9 for a target JVM < 9. I'm using Java 8 on my current project.
Found some useful information here: https://www.baeldung.com/maven-java-version. This states that By default, the -source and -target options don't guarantee a cross-compilation.
Probably we should have something like this in the pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
instead of:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
Run a simple Java project on Java 1.8 which contains the following class:
import org.mandas.docker.client.DefaultDockerClient;
import org.mandas.docker.client.DockerClient;
import org.mandas.docker.client.DockerClient.LogsParam;
import org.mandas.docker.client.LogStream;
import org.mandas.docker.client.exceptions.DockerCertificateException;
import org.mandas.docker.client.exceptions.DockerException;
public class TestDockerClient {
public static void main(String[] args) throws DockerCertificateException, DockerException, InterruptedException {
DockerClient docker = DefaultDockerClient.fromEnv().build();
String existingContainerId = "dfa449ae6603";
LogStream ls = docker.logs(existingContainerId, LogsParam.stderr(),
LogsParam.stdout(), LogsParam.since(0));
//Error thrown here
System.out.println(ls.hasNext());
}
}
I would expect ls.hasNext()
to return a boolean.
ls.hasNext()
throws java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer
Error.
docker version
:Client: Docker Engine - Community
Version: 19.03.1
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89e8a
Built: Thu Jul 25 21:21:35 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.1
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89e8a
Built: Thu Jul 25 21:20:09 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
org.mandas:docker-client:2.0.1:shaded
Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
at org.mandas.docker.client.LogReader.nextMessage(LogReader.java:61)
at org.mandas.docker.client.DefaultLogStream.computeNext(DefaultLogStream.java:56)
at org.mandas.docker.client.DefaultLogStream.computeNext(DefaultLogStream.java:35)
at org.mandas.docker.client.shaded.com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:141)
at org.mandas.docker.client.shaded.com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:136)
at org.mandas.docker.client.DefaultLogStream.readFully(DefaultLogStream.java:77)
at TestDockerClient.TestDockerClient.main(TestDockerClient.java:27)
Docker 20.10 added support for batch, one-off jobs.
v1.31 for config
No point writing malformed javadocs
Seems that the following methods were incorrectly removed:
LogConfig#create(String, Map<String, String>)
PortBinding#create(String, String)
IpamConfig#create(String, String, String)
and need to be reverted
Used guava dependency suffers from CVE-2018-10237. Even though the severity is medium while docker-client is not affected, it would be good to have it addressed to eliminate the vulnerability from downstream users' security reports.
Line 67 in 50a546e
After upgrading to version 3.2.1 of docker-client I see a stacktrace with java.lang.ClassNotFoundException: javax.activation.DataSource
. There is no difference whether I use the shaded or non-shaded version of docker-client and it doesn't seem to cause any actual error in our code. This is caused by the removal of javax.activation as a dependency and manually adding it back removes the warning again.
Every REST call made by Jersey seems to create this error message.
No error message
See stacktrace below
docker version
: 19.03.8-ce (both client and server)apr. 20, 2020 1:06:25 P.M. org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: HK2 failure has been detected in a code that does not run in an active Jersey Error scope.
WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.DataSourceProvider] with an exception:
MultiException stack 1 of 2
java.lang.NoClassDefFoundError: javax/activation/DataSource
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2357)
at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1354)
at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1350)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1350)
at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1293)
at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:60)
at org.glassfish.jersey.inject.hk2.JerseyClassAnalyzer.getConstructor(JerseyClassAnalyzer.java:124)
at org.jvnet.hk2.internal.Utilities.getConstructor(Utilities.java:156)
at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:105)
at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:156)
at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:716)
at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:670)
at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:442)
at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2300)
at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:106)
at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1385)
at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1380)
at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:105)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1442)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1368)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1356)
at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:134)
at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:30)
at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:307)
at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:151)
at org.glassfish.jersey.message.internal.MessageBodyFactory.initialize(MessageBodyFactory.java:219)
at org.glassfish.jersey.message.internal.MessageBodyFactory$MessageBodyWorkersConfigurator.postInit(MessageBodyFactory.java:114)
at org.glassfish.jersey.client.ClientConfig$State.lambda$initRuntime$2(ClientConfig.java:451)
at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4390)
at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:451)
at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:317)
at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:807)
at org.glassfish.jersey.client.ClientRequest.getClientRuntime(ClientRequest.java:219)
at org.glassfish.jersey.client.ClientRequest.getInjectionManager(ClientRequest.java:610)
at org.glassfish.jersey.client.JerseyWebTarget.onBuilder(JerseyWebTarget.java:364)
at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:199)
at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:36)
at org.mandas.docker.client.DefaultDockerClient.execStart(DefaultDockerClient.java:1644)
at no.mnemonic.commons.junit.docker.CassandraDockerResource.executeCqlScript(CassandraDockerResource.java:157)
at no.mnemonic.commons.utilities.ObjectUtils.ifNotNullDo(ObjectUtils.java:92)
at no.mnemonic.commons.junit.docker.CassandraDockerResource.truncate(CassandraDockerResource.java:62)
at no.mnemonic.act.platform.dao.cassandra.AbstractManagerTest.cleanup(AbstractManagerTest.java:47)
at jdk.internal.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.RunAfters.invokeMethod(RunAfters.java:46)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 83 more
MultiException stack 2 of 2
java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
implementation=org.glassfish.jersey.message.internal.DataSourceProvider
contracts={javax.ws.rs.ext.MessageBodyWriter,javax.ws.rs.ext.MessageBodyReader}
scope=javax.inject.Singleton
qualifiers={}
descriptorType=CLASS
descriptorVisibility=NORMAL
metadata=
rank=0
loader=null
proxiable=null
proxyForSameScope=null
analysisName=null
id=14
locatorId=53
identityHashCode=1602314131
reified=false)
at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:681)
at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:442)
at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2300)
at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:106)
at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1385)
at org.jvnet.hk2.internal.ServiceLocatorImpl$10.compute(ServiceLocatorImpl.java:1380)
at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:105)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1442)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1368)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1356)
at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:134)
at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:30)
at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:307)
at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:151)
at org.glassfish.jersey.message.internal.MessageBodyFactory.initialize(MessageBodyFactory.java:219)
at org.glassfish.jersey.message.internal.MessageBodyFactory$MessageBodyWorkersConfigurator.postInit(MessageBodyFactory.java:114)
at org.glassfish.jersey.client.ClientConfig$State.lambda$initRuntime$2(ClientConfig.java:451)
at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4390)
at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:451)
at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:317)
at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:807)
at org.glassfish.jersey.client.ClientRequest.getClientRuntime(ClientRequest.java:219)
at org.glassfish.jersey.client.ClientRequest.getInjectionManager(ClientRequest.java:610)
at org.glassfish.jersey.client.JerseyWebTarget.onBuilder(JerseyWebTarget.java:364)
at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:199)
at org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:36)
at org.mandas.docker.client.DefaultDockerClient.execStart(DefaultDockerClient.java:1644)
at no.mnemonic.commons.junit.docker.CassandraDockerResource.executeCqlScript(CassandraDockerResource.java:157)
at no.mnemonic.commons.utilities.ObjectUtils.ifNotNullDo(ObjectUtils.java:92)
at no.mnemonic.commons.junit.docker.CassandraDockerResource.truncate(CassandraDockerResource.java:62)
at no.mnemonic.act.platform.dao.cassandra.AbstractManagerTest.cleanup(AbstractManagerTest.java:47)
at jdk.internal.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.RunAfters.invokeMethod(RunAfters.java:46)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
copied from spotify/docker-client#1092
Is this a BUG REPORT or FEATURE REQUEST?:
BUG REPORT
The example code in the following doc section uses appendBinds but that method has been removed.
See the doc
Please add an example that shows how to mount a volume in a container without using appendBinds. Preferably show how to incrementally add binds now that appendBinds has been removed. I am guessing this should be done by setting the full list of binds each time. That is, append to the list and then pass the entire list to bind(), but I'm not sure if that is correct.
Based on the docker API changelog, from version 1.25, Docker added HostConfig.Init field to POST /containers/create to run an init inside the container that forwards signals and reaps processes. Right now, it is not possible to configure this field through the HostConfig.Builder class. It'd be great to add support for this.
Is this a BUG REPORT or FEATURE REQUEST?:
I am trying to use the DockerClient and I keep seeming to have an issue making consecutive calls with the same client object, throwing an error and closing the connection. Below is an example:
DockerClient docker;
try {
docker = new JerseyDockerClientBuilder().fromEnv().build();
} catch (DockerCertificateException e) {
throw new AdminException(TuringAdminLogCode.DOCKER_UNABLE_TO_ESTABLISH_ENVIRONMENT);
}
...
ExecCreation execIdmkdir = docker.execCreate(containerId,
new String[]{"bash", "-c", "mkdir -p " + licensePath},
DockerClient.ExecCreateParam.attachStdout(),
DockerClient.ExecCreateParam.attachStderr());
final LogStream stream1 = docker.execStart(execIdmkdir.id());
ExecCreation execIdWriteKeycode = docker.execCreate(containerId,
new String[]{"bash", "-c", "echo \"" + keycodes[0] + "\" > " + licensePath + "keycodes"},
DockerClient.ExecCreateParam.attachStdout(),
DockerClient.ExecCreateParam.attachStderr());
final LogStream stream2 = docker.execStart(execIdWriteKeycode.id());
The first works. The second throws an error ('javax.ws.rs.ProcessingException: java.lang.IllegalStateException: Connection is still allocated'). I keep running into this and not sure how to overcome it. I am missing something fundamentally of how to use a single instantiated DockerClient object and make numerous calls.
[Add steps on how to reproduce this issue]
[Describe what do you expect to happen]
[Describe the actual results]
docker version
: [Add the output of docker version
here, both client and server][Paste full backtrace here]
(This is valid from 17.06.0 onwards)
docker-client
currently pulls Jersey client for performing the REST calls to a Docker engine. This is not actually right since it also manages pooling semantics which is a consumer's responsibility. Moreover, when docker-client
is pulled in projects where a non-Jersey REST client exists (e.g. resteasy), clients projects are ending up having two implementations of the JAX-RS client API and this is certainly a problem in flat-classpath applications.
So, effort should be spent so as to make docker-client
agnostic so that client projects can use their own javax.ws.rs.client.Client
implementation. There are two ways forward to solve this problem:
(medium impact) Either drop completely Jersey dependencies and allow client projects to pass an already-constructed javax.ws.rs.client.Client
implementation or
(minimum impact) Extract DefaultDockerClient$Builder
to JerseyDockerClientBuilder
(or something similar) and switch the Jersey dependencies to <optiona>true</optional>
and let consumer projects use this builder or an alternative of their choice.
edit: JavaEE not a problem, flat-classpath is
v1.37
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.