B
B
bigazzzz2021-03-09 12:35:58
Computer networks
bigazzzz, 2021-03-09 12:35:58

How to access a docker(DinD) subnet from another docker(Jenkins)?

Good afternoon.
There are two dockers running on the host - Docker in Docker (DinD) and Jenkins.
Jenkins runs its dockers in DinD. How can I get access from Jenkins to containers created in DinD?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zohan1993, 2021-03-12
@zohan1993

without knowing the details of the settings, it is difficult to advise something
. Most likely, if you look at the IP addresses of these containers on the host machine, you will see something like the following:

docker inspect --format '{{ .NetworkSettings.IPAddress }}' dind
172.17.0.2
docker inspect --format '{{ .NetworkSettings.IPAddress }}' jenkins
172.17.0.3

this means that they are on the same network and are available to each other
, therefore, if containers are created in DinD with port forwarding (for example, for postgresql - "--publish 0.0.0.0:5432:5432"), then access from the Jenkins container to the created in DinD containers can be obtained by the container IP dind (172.17.0.2) + PORT of the desired container running in Dind (postgresql - 5432) --> 172.17.0.2:5432

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question