[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Vivek Anand updated an issue Jenkins / JENKINS-49567 Automatically support docker networks in pipelines with multiple containers Change By: Vivek Anand Comment: I was looking for the exact same thing, but then we could use the docker.withRun to start a container(pause container) and then join all the other containers to the pause container network.This gives us the benefit of not having to remember to delete the network and is similar to how AWS fargate or Kubernetes does the networking to provide inter container communciation. Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188477.151865502.4143.1574234640539%40Atlassian.JIRA.
[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Vivek Anand commented on JENKINS-49567 Re: Automatically support docker networks in pipelines with multiple containers I was looking for the exact same thing, but then we could use the docker.withRun to start a container(pause container) and then join all the other containers to the pause container network. This gives us the benefit of not having to remember to delete the network and is similar to how AWS fargate or Kubernetes does the networking to provide inter container communciation. Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188477.151865502.3058.1574146980337%40Atlassian.JIRA.
[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Ryan Desmond edited a comment on JENKINS-49567 Re: Automatically support docker networks in pipelines with multiple containers This would be great, particularly with the deprecation of the {{--link}} option in docker.An alternative that would be a more purposeful with a sidecar pattern would be to have a function that surrounds any docker calls and switches each from the default network to a local one:{code:java}docker.withNetwork { docker.image('sidecar').withRun() { c-> docker.image('main').inside() { // do something with host "${c.name}" } }}{code} Currently, I have a function that works around this: {code:java}def withDockerNetwork(Closure inner) {try {networkId = UUID.randomUUID().toString()sh "docker network create ${networkId}"inner.call(networkId)} finally {sh "docker network rm ${networkId}"}}{code}{code:java}withDockerNetwork{ n -> docker.image('sidecar').withRun("--network ${n} --name sidecar") { c-> docker.image('main').inside("--network ${n}") { // do something with host "sidecar" } }} {code} (note that the names have to be globally unique, so they have to be generated) Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Ryan Desmond edited a comment on JENKINS-49567 Re: Automatically support docker networks in pipelines with multiple containers This would be great, particularly with the deprecation of the {{--link}} option in docker.An alternative that would be a more purposeful with a sidecar pattern would be to have a function that surrounds any docker calls and switches each from the default network to a local one:{code:java}docker.withNetwork { docker.image('sidecar').withRun() { c-> docker.image('main').inside() { // do something with host "${c. id name }" } }}{code} Currently, I have a function that works around this: {code:java}def withDockerNetwork(Closure inner) {try { network_id networkId = UUID.randomUUID().toString()sh "docker network create ${ network_id networkId }"inner.call( network_id networkId )} finally {sh "docker network rm ${ network_id networkId }"}}{code}{code:java}withDockerNetwork{ n -> docker.image('sidecar').withRun("--network ${n} --name sidecar ") { c-> docker.image('main').inside("--network ${n}") { // do something with host " ${c.id} sidecar " } }} {code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Ryan Desmond edited a comment on JENKINS-49567 Re: Automatically support docker networks in pipelines with multiple containers This would be great, particularly with the deprecation of the {{--link}} option in docker.An alternative that would be a more purposeful with a sidecar pattern would be to have a function that surrounds any docker calls and switches each from the default network to a local one:{code:java}docker.withNetwork { docker.image('sidecar').withRun() { c-> docker.image('main').inside() { // do something with host "${c.id}" } }}{code} Currently, I have a function that works around this: {code:java}def withDockerNetwork(Closure inner) {try {network_id = UUID.randomUUID().toString()sh "docker network create ${network_id}"inner.call(network_id)} finally {sh "docker network rm ${network_id}"}}{code}{code:java}withDockerNetwork{ n -> docker.image('sidecar').withRun("--network ${n .id }") { c-> docker.image('main').inside("--network ${n .id }") { // do something with host "${c.id}" } }} {code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Ryan Desmond edited a comment on JENKINS-49567 Re: Automatically support docker networks in pipelines with multiple containers This would be great, particularly with the deprecation of the {{ – -- link}} option in docker.An alternative that would be a more purposeful with a sidecar pattern would be to have a function that surrounds any docker calls and switches each from the default network to a local one:{code:java}docker.withNetwork { docker.image('sidecar').withRun() { c-> docker.image('main').inside() { // do something with host "${c.id}" } }}{code} Currently, I have a function that works around this: {code:java}def withDockerNetwork(Closure inner) {try {network_id = UUID.randomUUID().toString()sh "docker network create ${network_id}"inner.call(network_id)} finally {sh "docker network rm ${network_id}"}}{code}{code:java}withDockerNetwork{ n -> docker.image('sidecar').withRun("--network ${n.id}") { c-> docker.image('main').inside("--network ${n.id}") { // do something with host "${c.id}" } }} {code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Ryan Desmond edited a comment on JENKINS-49567 Re: Automatically support docker networks in pipelines with multiple containers This would be great, particularly with the deprecation of the {{–link}} option in docker.An alternative that would be a more purposeful with a sidecar pattern would be to have a function that surrounds any docker calls and switches each from the default network to a local one : {code:java} docker.withNetwork { docker.image('sidecar').withRun() { c-> docker.image('main').inside() { // do something with host "${c.id}" } }}{ code } Currently, I have a function that works around this : {code: java} def withDockerNetwork(Closure inner) {try {network_id = UUID.randomUUID().toString()sh " docker network create ${network_id}"inner . withNetwork call(network_id)} finally { sh "docker network rm ${network_id}"}}{code}{code:java}withDockerNetwork{ n -> docker.image('sidecar').withRun(" – -- network ${n.id}") { c-> docker.image('main').inside(" – -- network ${n.id}") { // do something with host "${c.id}" } }}{code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Ryan Desmond commented on JENKINS-49567 Re: Automatically support docker networks in pipelines with multiple containers This would be great, with the deprecation of the –link option in docker. An alternative that would be a more purposeful: docker.withNetwork{ n -> docker.image('sidecar').withRun("–network ${n.id}") { docker.image('main').inside("–network ${n.id}") { // do something } } } Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49567) Automatically support docker networks in pipelines with multiple containers
Title: Message Title Andrew Berry created an issue Jenkins / JENKINS-49567 Automatically support docker networks in pipelines with multiple containers Issue Type: New Feature Assignee: Unassigned Components: docker-workflow-plugin Created: 2018-02-15 00:37 Priority: Minor Reporter: Andrew Berry As is, it's not possible to create a Jenkinsfile with docker containers that need to communicate with each other (and not just a basic connection from container A to container B). For example, when running Behat tests for Drupal: The webapp container (with PHP etc) çontains Behat, which needs to be able to link to the Selenium container. The Selenium container needs to be able to link back to the webapp container to load pages. This leads to a chicken-and-the-egg problem, since you can't know the ID of a container before it starts. I imagine there's a way to hack it with container names, but that seems collision prone. Under other tools like Circle CI, a docker network is transparently created and all containers ports from their Dockerfiles are automatically exposed to each other. For example, even though there are two containers, from both perspectives all ports are available on localhost. On top of this, the recommended --link parameter has been deprecated by docker, so moving to bridge networks will keep the plugin working with future Docker releases.