{"action":"created","issue":{"url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/389","repository_url":"https://api.github.com/repos/jenkinsci/docker-plugin","labels_url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/389/labels{/name}","comments_url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/389/comments","events_url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/389/events","html_url":"https://github.com/jenkinsci/docker-plugin/issues/389","id":148353228,"number":389,"title":"Cannot build docker images: \"Could not get client\"","user":{"login":"sirhopcount","id":1218282,"avatar_url":"https://avatars.githubusercontent.com/u/1218282?v=3","gravatar_id":"","url":"https://api.github.com/users/sirhopcount","html_url":"https://github.com/sirhopcount","followers_url":"https://api.github.com/users/sirhopcount/followers","following_url":"https://api.github.com/users/sirhopcount/following{/other_user}","gists_url":"https://api.github.com/users/sirhopcount/gists{/gist_id}","starred_url":"https://api.github.com/users/sirhopcount/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sirhopcount/subscriptions","organizations_url":"https://api.github.com/users/sirhopcount/orgs","repos_url":"https://api.github.com/users/sirhopcount/repos","events_url":"https://api.github.com/users/sirhopcount/events{/privacy}","received_events_url":"https://api.github.com/users/sirhopcount/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-04-14T12:58:24Z","updated_at":"2016-08-24T08:30:10Z","closed_at":null,"body":"Hi,\r\n\r\nI am having some trouble building images. Every time I run the job I get the following error:\r\n\r\n```\r\nDocker Build\r\nDocker Build: building image at path /var/lib/jenkins/jobs/docker_image_build/workspace/dockerfiles/Apache/base-jessie\r\nERROR: Build step failed with exception\r\njava.lang.IllegalArgumentException: Could not get client because we could not find the cloud that the project was built on. What this build run on Docker?\r\n\tat org.apache.commons.lang.Validate.notNull(Validate.java:192)\r\n\tat com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run.getClient(DockerBuilderPublisher.java:173)\r\n\tat com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run.access$200(DockerBuilderPublisher.java:116)\r\n\tat com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run$1.invoke(DockerBuilderPublisher.java:246)\r\n\tat com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run$1.invoke(DockerBuilderPublisher.java:232)\r\n\tat hudson.FilePath.act(FilePath.java:990)\r\n\tat hudson.FilePath.act(FilePath.java:968)\r\n\tat com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run.buildImage(DockerBuilderPublisher.java:232)\r\n\tat com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher$Run.run(DockerBuilderPublisher.java:189)\r\n\tat com.nirima.jenkins.plugins.docker.builder.DockerBuilderPublisher.perform(DockerBuilderPublisher.java:306)\r\n\tat hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)\r\n\tat hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)\r\n\tat hudson.model.Build$BuildExecution.build(Build.java:205)\r\n\tat hudson.model.Build$BuildExecution.doRun(Build.java:162)\r\n\tat hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)\r\n\tat hudson.model.Run.execute(Run.java:1738)\r\n\tat hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)\r\n\tat hudson.model.ResourceController.execute(ResourceController.java:98)\r\n\tat hudson.model.Executor.run(Executor.java:410)\r\nBuild step 'Build / Publish Docker Containers' marked build as failure\r\nFinished: FAILURE\r\n```\r\nTo elaborate some more, docker is running locally and a \"cloud\" is configured. I have no problem starting an already existing image via a job but building one for some reason fails.\r\n\r\nThere is also no option to specify a cloud in the \"Build / Publish Docker Containers\" build step.\r\n\r\nThe Cloud section from config.xml\r\n\r\n```\r\n<clouds>\r\n    <com.nirima.jenkins.plugins.docker.DockerCloud plugin=\"docker-plugin@0.16.0\">\r\n      <name>docker</name>\r\n      <templates>\r\n        <com.nirima.jenkins.plugins.docker.DockerTemplate>\r\n          <configVersion>2</configVersion>\r\n          <labelString>jenkinsslave</labelString>\r\n          <launcher class=\"com.nirima.jenkins.plugins.docker.launcher.DockerComputerSSHLauncher\">\r\n            <sshConnector plugin=\"ssh-slaves@1.10\">\r\n              <port>22</port>\r\n              <credentialsId>64b21707-c8e9-4a8e-a0fc-345488070b2c</credentialsId>\r\n              <jvmOptions></jvmOptions>\r\n              <javaPath></javaPath>\r\n              <maxNumRetries>0</maxNumRetries>\r\n              <retryWaitTime>0</retryWaitTime>\r\n            </sshConnector>\r\n          </launcher>\r\n          <remoteFsMapping></remoteFsMapping>\r\n          <remoteFs>/home/jenkins</remoteFs>\r\n          <instanceCap>1</instanceCap>\r\n          <mode>NORMAL</mode>\r\n          <retentionStrategy class=\"com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy\">\r\n            <idleMinutes>10</idleMinutes>\r\n            <idleMinutes defined-in=\"com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy\">10</idleMinutes>\r\n          </retentionStrategy>\r\n          <numExecutors>1</numExecutors>\r\n          <dockerTemplateBase>\r\n            <image>jenkinsslave</image>\r\n            <dockerCommand></dockerCommand>\r\n            <lxcConfString></lxcConfString>\r\n            <hostname></hostname>\r\n            <dnsHosts/>\r\n            <volumes/>\r\n            <volumesFrom2/>\r\n            <environment/>\r\n            <bindPorts></bindPorts>\r\n            <bindAllPorts>false</bindAllPorts>\r\n            <privileged>false</privileged>\r\n            <tty>false</tty>\r\n            <extraHosts class=\"java.util.Collections$UnmodifiableRandomAccessList\" resolves-to=\"java.util.Collections$UnmodifiableList\">\r\n              <c class=\"list\"/>\r\n              <list reference=\"../c\"/>\r\n            </extraHosts>\r\n          </dockerTemplateBase>\r\n          <removeVolumes>false</removeVolumes>\r\n          <pullStrategy>PULL_NEVER</pullStrategy>\r\n        </com.nirima.jenkins.plugins.docker.DockerTemplate>\r\n      </templates>\r\n      <serverUrl>unix:///var/run/docker.sock</serverUrl>\r\n      <connectTimeout>0</connectTimeout>\r\n      <readTimeout>0</readTimeout>\r\n      <credentialsId></credentialsId>\r\n      <containerCap>100</containerCap>\r\n    </com.nirima.jenkins.plugins.docker.DockerCloud>\r\n  </clouds>\r\n```\r\n\r\nI am using the following versions:\r\n\r\n```\r\nJenkins: 1.656\r\nDocker plugin: 0.16.0\t\r\n```"},"comment":{"url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/comments/241993592","html_url":"https://github.com/jenkinsci/docker-plugin/issues/389#issuecomment-241993592","issue_url":"https://api.github.com/repos/jenkinsci/docker-plugin/issues/389","id":241993592,"user":{"login":"KostyaSha","id":231611,"avatar_url":"https://avatars.githubusercontent.com/u/231611?v=3","gravatar_id":"","url":"https://api.github.com/users/KostyaSha","html_url":"https://github.com/KostyaSha","followers_url":"https://api.github.com/users/KostyaSha/followers","following_url":"https://api.github.com/users/KostyaSha/following{/other_user}","gists_url":"https://api.github.com/users/KostyaSha/gists{/gist_id}","starred_url":"https://api.github.com/users/KostyaSha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KostyaSha/subscriptions","organizations_url":"https://api.github.com/users/KostyaSha/orgs","repos_url":"https://api.github.com/users/KostyaSha/repos","events_url":"https://api.github.com/users/KostyaSha/events{/privacy}","received_events_url":"https://api.github.com/users/KostyaSha/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T08:30:10Z","updated_at":"2016-08-24T08:30:10Z","body":"> Even if I restrict the job to master it still gives the same error:\r\n> \r\n> \r\n> \r\n> Could not get client because we could not find the cloud that the project was built on. What this build run on Docker?\r\n\r\nYou must not run JOB on MASTER.\r\n\r\n`java.lang.IllegalArgumentException: Could not get client because we could not find the cloud that the project was built on. What this build run on Docker?`\r\nmeans that CMD tries extract docker client connection from running slave where build happens and it MUST be docker provisioned slave."}}
{"actor":{"display_login":"KostyaSha"}}