1

So I have a bit of a docker network problem that I cannot get to work. I have a compose file for all of my systems. gitlab, sonar, nexus, jenkins live inside this compose file. Containers: prod-gitlab, prod-jenkins, prod-sonar, prod-nexus I have my jenkins slave set up to use the Docker Plugin so slaves can be created as needed. The docker host prod-jenkins is connected to is the same host that is running prod-jenkins. So this is all on the same host, there is no external PC needed. Now, my problem is that my docker slave cannot access the prod-gitlab to retrieve the source code. My prod-jenkins is able to resolve the hostname "prod-gitlab" because they are inside the same compose file (i.e. on the same docker network). I cannot find a way to link my docker slaves that get spun up to this network even if i add the environment variables --link systems_prod-gitlab_1 or if I just do --network systems. It's important to note that gitlab runs on port 80. So I expose port 8081 while the internal port is 80. I cannot specify the external port (8081) inside my build because then jenkins wouldn't be able to connect with gitlab and would throw an error. One solution I've thought of is find a way to make gitlab run on a port other than 80 and make the internal and external match, but I only want to do that if I absolutely must. So I guess to simplify "How do I get my docker slave into the docker network with all of my systems because even if I could connect it to gitlab right now, it would just fail to connect to nexus and sonar later. So I need them to be on the same docker network"?

Jenkins Slave Cant Connect Job Build Description Docker Template

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
GSUgambit
  • 4,459
  • 6
  • 25
  • 31

2 Answers2

0

Actually the plugin has a section named "Container settings" where you can specify the docker network. Sorry guys, I knew this had to be simple. I guess the environment section inside the other part is for build environment variables.

GSUgambit
  • 4,459
  • 6
  • 25
  • 31
0

I have a similar problem with a Master / Slave on Ubuntu configuration. Master run on Ubuntu 16.04, and slaves run on Ubuntu 18.04. After several checks, I created slaves on Ubuntu 16.04 and they do not have the DNS problem.

Joaquín
  • 106
  • 1
  • 7