jenkins和码头工人:未指定uri

前端之家收集整理的这篇文章主要介绍了jenkins和码头工人:未指定uri前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在jenkins安装了docker,jenkins和docker-build-step.

我已经设置了一个步骤,以便从我的存储库的Dockerfile构建一个图像.

它把这个消息转发给我:

Started by BitBucket push by living_jordi
Started by BitBucket push by living_jordi
Building in workspace /var/lib/jenkins/workspace/Create Docker Images
Cloning the remote Git repository
Cloning repository git@bitbucket.org:livingdigital/docker-images.git
git init /var/lib/jenkins/workspace/Create Docker Images # timeout=10
Fetching upstream changes from git@bitbucket.org:livingdigital/docker-images.git
git --version # timeout=10
using GIT_SSH to set credentials BitBucket Private Key
git -c core.askpass=true fetch --tags --progress git@bitbucket.org:livingdigital/docker-images.git +refs/heads/*:refs/remotes/origin/*
git config remote.origin.url git@bitbucket.org:livingdigital/docker-images.git # timeout=10
git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
git config remote.origin.url git@bitbucket.org:livingdigital/docker-images.git # timeout=10
Fetching upstream changes from git@bitbucket.org:livingdigital/docker-images.git
using GIT_SSH to set credentials BitBucket Private Key
git -c core.askpass=true fetch --tags --progress git@bitbucket.org:livingdigital/docker-images.git +refs/heads/*:refs/remotes/origin/*
git rev-parse refs/remotes/origin/master^{commit} # timeout=10
git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 058ecd67befe53fb5e4d18e8103b955a1daadbe3 (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f 058ecd67befe53fb5e4d18e8103b955a1daadbe3
First time build. Skipping changelog.
ERROR: Build step Failed with exception
java.lang.NullPointerException: uri was not specified
  at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
  at com.github.dockerjava.core.DockerClientConfig$DockerClientConfigBuilder.withUri(DockerClientConfig.java:406)
  at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.createDockerClient(DockerBuilder.java:120)
  at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.getDockerClient(DockerBuilder.java:204)
  at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:68)
  at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
  at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
  at hudson.model.Build$BuildExecution.build(Build.java:205)
  at hudson.model.Build$BuildExecution.doRun(Build.java:162)
  at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
  at hudson.model.Run.execute(Run.java:1720)
  at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
  at hudson.model.ResourceController.execute(ResourceController.java:98)
  at hudson.model.Executor.run(Executor.java:410)
Build step 'Execute Docker command' marked build as failure

有任何想法吗?

编辑
这是我的与连接相关的docker.service配置文件

ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock

Docker正在倾听:

netstat -tupln | grep 4243
tcp        0      0 127.0.0.1:4243          0.0.0.0:*               LISTEN 

我已经使用了Docker Builder配置,并将Docker URL设置为http://127.0.0.1:4243.测试连接告诉我:

Something went wrong,cannot connect to tcp://127.0.0.1:4243,cause: null

我还使用此命令curl -XGET http:// localhost:4243 / containers / json向API REST发出请求,结果是正确的:

[
  {
    "Id":"27e79f6a504c5c5359630a30bc5c222b68bafaede774bd5462ac410dc0d34c36","Names":[
      "/registry"
    ],"Image":"registry:2","ImageID":"sha256:8ff6a4aae6575dace6b603626816e74e71e93aa54dfb670daff0a7426706e58c","Command":"/bin/registry serve /etc/docker/registry/config.yml","Created":1467798010,"Ports":[
      {
        "IP":"0.0.0.0","PrivatePort":5000,"PublicPort":5000,"Type":"tcp"
      }
    ],"Labels":{

    },"State":"restarting","Status":"Restarting (2) 10 hours ago","HostConfig":{
      "NetworkMode":"default"
    },"NetworkSettings":{
      "Networks":{
        "bridge":{
          "IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"","EndpointID":"4c5a73c2ca7b9aeeff2384e0182e7b83a53cd1e7a9efd5fa416bb8c009b60568","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"
        }
      }
    },"Mounts":[
      {
        "Source":"/root/docker-registry/certs","Destination":"/certs","Mode":"","RW":true,"Propagation":"rprivate"
      },{
        "Source":"/root/docker-registry/data","Destination":"/var/lib/registry",{
        "Source":"/root/docker-registry/auth","Destination":"/auth","Propagation":"rprivate"
      }
    ]
  }
]

我点击Test Connection时也复制了日志信息.尽管我已经指定了uri,但消息完全相同:

Jul 07,2016 7:22:04 AM FINE org.jenkinsci.plugins.dockerbuildstep.DockerBuilder
Trying to get client for http://127.0.0.1:4243 and version 
Jul 07,2016 7:22:04 AM WARNING org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl
doTestConnection
uri was not specified java.lang.NullPointerException: uri was not specified     at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
  at com.github.dockerjava.core.DockerClientConfig$DockerClientConfigBuilder.withUri(DockerClientConfig.java:406)
  at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.createDockerClient(DockerBuilder.java:120)
  at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.getDockerClient(DockerBuilder.java:204)
  at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.doTestConnection(DockerBuilder.java:138)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)   
  at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:324)
  at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:167)  
  at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:100)
  at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:124)     
  at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
  at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)    
  at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)   
  at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)     
  at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
  at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)    
  at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)   
  at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)   
  at org.kohsuke.stapler.Stapler.service(Stapler.java:238)  
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)   
  at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
  at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
  at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
  at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:80)     
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
  at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
  at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
  at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
  at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
  at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
  at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
  at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
  at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
  at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
  at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
  at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)   
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
  at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
  at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
  at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
  at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
  at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
  at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
  at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
  at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
  at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
  at org.eclipse.jetty.server.Server.handle(Server.java:499)    
  at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)  
  at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
  at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
  at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
最佳答案
使用jenkins版本的2.51和docker版本1.13.1,您可以执行以下操作来解决此问题.首先将以下内容添加到ExecStart(在docker.service中):

ExecStart=/usr/bin/dockerd -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock

然后去Jenkins – >管理Jenkins – >配置系统 – > Docker构建器.
在这里你指定:

tcp://127.0.0.1:4243

作为Docker URL.应用并测试连接.

原文链接:https://www.f2er.com/docker/436083.html

猜你在找的Docker相关文章