0

I'm trying to run tests of a spring boot application when it writes to mongodb using the testcontainers test library. Testcontainers should spin up a Docker image running mongodb. Then I run my test, it connects to the data store, writes something and I have assertions that make sure the stuff got stored. Then it all goes away.

The test needs to run on a Jenkins build agent (on Red Hat Linux 7.5) inside our corporate network which is pretty well locked down.

We have Artifactory set up with a proxy to docker hub. When I normally do a docker login I give it https://artifactory.example.com or just do docker run with "artifactory.example.com/docker-all/image:1.2.3"

The log on the Jenkins run has this in it:

00:02:13.052  2019-05-22 00:15:59.647  INFO 83570 --- [           main] o.t.d.DockerClientProviderStrategy       : Found Docker environment with Environment variables, system properties and defaults. Resolved: 
00:02:13.052      dockerHost=unix:///var/run/docker.sock
00:02:13.052      apiVersion='{UNKNOWN_VERSION}'
00:02:13.052      registryUrl='https://index.docker.io/v1/'
00:02:13.052      registryUsername='cicduser'
00:02:13.052      registryPassword='null'
00:02:13.052      registryEmail='null'
00:02:13.052      dockerConfig='DefaultDockerClientConfig[dockerHost=unix:///var/run/docker.sock,registryUsername=cicduser,registryPassword=<null>,registryEmail=<null>,registryUrl=https://index.docker.io/v1/,dockerConfigPath=/home/cicduser/.docker,sslConfig=<null>,apiVersion={UNKNOWN_VERSION},dockerConfig=<null>]'

Question: I don't know how to get the registryUrl listed there to be "https://artifactory.example.com/docker-all" and the registryUsername and registryPasswords set correctly (if our Artifactory gets locked down for reads).

There is lots of info to find online about using an HTTP proxy providing access to the internet at large. I think I have found how to do that. But that's not what I need to do.

Lee Meador
  • 12,829
  • 2
  • 36
  • 42

1 Answers1

0

It seems you can't change the URL

You can login to your artifactory docker hub remote in the same way in Jenkins, probably by using the credentials plugin - assuming you have Jenkinsfiles

Hopefully you can also get to your artifactory from your Jenkins docker agent. If not, then that is a separate problem

KeepCalmAndCarryOn
  • 8,817
  • 2
  • 32
  • 47
  • 1) I understand what the link is saying. The Docker team does not allow configuring a proxy to docker.io. 2) I tried adding a "docker login ..." in the scripted Jenkinsfile, before running the test. The logs still say its looking in index.docker.io, exactly as above, and it fails. 3) before the tests, the same Jenkinsfile builds and pulls maven dependencies from the Artifactory. Same domain name. Different path. – Lee Meador May 29 '19 at 18:15
  • have you seen this https://www.jfrog.com/confluence/display/RTF/Getting+Started+with+Artifactory+as+a+Docker+Registry - with the on-prem with reverse proxy? – KeepCalmAndCarryOn May 30 '19 at 05:51
  • I am using the methods shown on that JFrog page to login to the Artifactory proxy. The problem is that the testcontainers code seems to want to go directly to docker hub even if I have already logged into our proxy. – Lee Meador Jun 28 '19 at 00:28