I want to connect to another docker daemon from within a docker container 
but it's not working from within jenkins.

The error I get is:

[restart_portal] Running shell script
Error response from daemon: No such container: 
5a0fce9025ba1d047d8da9718ab830222d3fdc9f2a38773efd1e9d117f7e1e79


Is there a workaround for this?



Here is a simple example:

scripted:

docker.image('myimage').inside {
docker.withServer('tcp://10.11.11.109:2376', 'my-docker-creds'){
sh 'docker ps'
}
}


declarative:

pipeline {
        agent {
          dockerfile {
            filename "jenkinsfiles/restart_portal/Dockerfile.aws"
            label "restart"            
          }
  
    stages {
      stage('connect to docker host') {
        }
        steps {          
          script {
            docker.withServer('tcp://10.11.11.109:2376', 'my-docker-creds'){
              sh "docker ps"  
            }
            
          }
        }            
      }
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5304179a-03dd-43bc-8066-775a7a528450%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to