How to link two containers for a Jenkins Job?

Viewed 388

I have configured my Jenkins to run our Build Jobs and functional Tests in a docker container. For example, when I click on the "Build Now"-Button - Jenkins will build the Dockerfile which is in Git and run the container so the Buildsteps (Jenkinsfile) can be done in this container.

My Question is now: How can I start another Container with MySQL-Server installed and link them to my Build-Job-Container everytime I Build my Job.

Thanks for any tips.

1 Answers

one can use service discovery aka Consul as IPs in docker networks are granted dynamicaly. Or use static ip

docker run --net bridge --ip 172.17.0.254 -it ubuntu bash
Related