Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Services do not operate correctly when docker net host option is specified #839

Closed
dave-tucker opened this issue Jan 21, 2015 · 6 comments
Closed

Comments

@dave-tucker
Copy link

The addition of --net in #617 is awesome, I need it, but I may have found a bug - I don't have bandwidth to test this one out at the moment though...

The implementation of services looks to rely on Docker Links
https://github.com/drone/drone/blob/0a6227930dce3e356667506bc950530a9d847c61/shared/build/build.go#L346

Links and --net=host are not supported moby/moby#7066

A possible workaround might be to run service containers in --net=host but you might run in to port conflict issues if you are, for example, using postgres as the backend for your Drone install and attempting to run a postgres service.

@bradrydzewski
Copy link

cool, we can test it out and see. I think we must have accepted a competing pull request (I'll verify), because you can specify the net parameter in your yaml:

docker:
  net: host

@dave-tucker
Copy link
Author

@bradrydzewski sorry I might not have been clear in my original message...
I've managed to confirm this one, given the following drone.yml

---
image: library/golang:1.3
docker:
  net: host
services:
  - mysql
script:
  - env
  - echo "Hello World"
  - ip a
  - sleep 30

This results in:

Error: Failed to start build container. Internal Server Error

@dave-tucker dave-tucker changed the title Services may not operate correctly using --net="host" Services do not operate correctly when docker net host option is specified Jan 21, 2015
dave-tucker added a commit to dave-tucker/drone that referenced this issue Jan 21, 2015
When the image runs with `--net host`, docker links will not work.
This commit checks to see if `--net host` has been set, and if so
creates the services in `--net host` also.

Fixes harness#839

Signed-off-by: Dave Tucker <[email protected]>
dave-tucker added a commit to dave-tucker/drone that referenced this issue Jan 21, 2015
When the image runs with `--net host`, docker links will not work.
This commit checks to see if `--net host` has been set, and if so
creates the services in `--net host` also.

Fixes harness#839

Signed-off-by: Dave Tucker <[email protected]>
dave-tucker added a commit to dave-tucker/drone that referenced this issue Jan 22, 2015
When the image runs with `--net host`, docker links will not work.
This commit checks to see if `--net host` has been set, and if so
creates the services in `--net host` also.

Fixes harness#839

Signed-off-by: Dave Tucker <[email protected]>
@floatdrop
Copy link

@dave-tucker can you give a hint, why you need a net: host for drone? We managed to get up and running Docker 1.5 with IPv6-only setup without using it.

@dave-tucker
Copy link
Author

@floatdrop we need our services and the container where the tests are run to share the same network namespace. net: host works, although using docker's --net=container:<container_name_or_id> would be much safer, but at the time of writing that functionality didn't exist in drone.

@bradrydzewski
Copy link

@dave-tucker I'm working on a patch that implement --net=container:{container}. Hopefully will have something to demo next week.

@bradrydzewski bradrydzewski modified the milestone: Unplanned Aug 18, 2015
@electrofelix
Copy link

Without drone supporting vagrant directly, where VM's are needed (involving building VM images, testing software making use of kernel modules, alternative OS's, etc) use of --net=host seems like it would be required for vagrant inside of a container image to be able to talk to VM's launched via libvirt.

Something like https://hub.docker.com/r/twiest/docker-vagrant-libvirt/

Just evaluating drone here as a replacement, and to be able to limit the use of VM's to just the project being tested rather than needing to also bring up additional services it needs as VM's along side it would be very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants