microsoft / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
1.73k stars 869 forks source link

Can i change the docker network when a vsts container is created? #4863

Open andrescolodrero opened 5 months ago

andrescolodrero commented 5 months ago

Describe your question

Can i change the docker network when a vsts container is created? When creating a new container, vsts agent creates it is own random network. i tried the settings; container: image: my_container options: --pull=missing --network bridge

but it is always created the vsts_network: /usr/bin/docker create --name xxx --label d2e6c3 --network vsts_network_b6afc1df51e6422b92b16d970a38edcc --pull=missing --network bridge -v "/var/run/docker.sock":"/var/run/docker.sock" -v .....

docker: conflicting options: cannot attach both user-defined and non-user-defined network-modes.

Versions

Azure Devops Agent 3.232.x

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Operation system

2022

Version controll system

No response

Azure DevOps Server Version (if applicable)

No response

vmapetr commented 4 months ago

Hi @andrescolodrero thanks for reporting! We are working on more prioritized issues at the moment, but will get back to this one soon.

msherms2 commented 2 weeks ago

This would be helpful as we notice that when we submit a lot of builds at once on our local self hosted agents, sometimes we see conflicts, resulting in a docker network create fail saying the network already exists. Effectively, two guids seem to be conflicted, and given what guids represent, this chance should be insanely low. It happens enough that it doesn't seem to be that rare.

I'd say unless the network name creation on the fly can key off something that changes more often (eliminating the conflict), the ability to change your network at creation time would be a decent enough workaround.