yet-another-docker-plugin
yet-another-docker-plugin copied to clipboard
Username auth support for DockerConnector doesn't work
Hello,
Steps to reproduce:
- Place docker behind http proxy with basic auth, for example https://github.com/srault95/docker-proxy-api
- Configure credentials in jekins (user, password)
- Configure jenkins plugin to use credentials
- Test connection and you will receive 401 error
Seems like credentials are not applying.
Yeah, proxy is always a pain :( Just for interest, even if jenkins will connect to docker host, how jenkins slaves will access your docker host?
Jenkins slave and docker host is the same instance. After container is created by jenkins master, slave connects to it via ssh.
I need understand connection flows in your setup.
Instance of what? Jenkins is one env and jenkins-slave, that jenkins spins via docker daemon is other.
If jenkins-master <-> jenkins slave has no ability to connect, then proxy auth wouldn't help.
Atm there is no any Proxy support for DockerConnector (either it was magically picked from dynamic resolvers). What target connection did you set in Docker connector? Docker daemon or your proxy? Classic proxy requires 2 addresses for connection to target instance:
- set target address (optionally with creds)
- set proxy address (optionally with creds) for proxy settings (missing in plugin)
Does https://github.com/srault95/docker-proxy-api forward requests itself with preconfigured target addresses?
Konstantin,
Docker proxy in my setup is just nginx that listens on external interface and proxy passes requests to docker socket. Jenkins slave, proxy and docker server are in one box. You can check my puppet module.
Could you provide some Dockerfile
(probably should be based on https://github.com/jpetazzo/dind because i run dind for tests) that will have similiar setup? I will pick it into integration tests then.
Or probably it can be just simulated with official nginx container + existing dind with rest api or shared socket via mounts.
Ok, i've prepared Dockerfile for you here: https://gist.github.com/kshcherban/44af2e8c95d6619b9e1a Basic auth user is docker, password is also docker. Nginx proxy port is 4243
com.github.kostyasha.yad.docker_java.org.apache.http.conn.HttpHostConnectException: Connect to 192.168.99.100:44445 [/192.168.99.100] failed: Connection refused com.github.kostyasha.yad.docker_java.javax.ws.rs.ProcessingException: com.github.kostyasha.yad.docker_java.org.apache.http.conn.HttpHostConnectException: Connect to 192.168.99.100:44445 [/192.168.99.100] failed: Connection refused
This error?
<html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx/1.9.10</center>
</body>
</html>
Jenkins uses docker-java and sets UsernamePassword for docker username/password, that is registry(?) creds(?)
Auth for connection should be provided by docker-java. Will try look later whether it supported by docker-java.