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

Fix services behaviour when docker net is host #841

Closed
wants to merge 1 commit into from

Conversation

dave-tucker
Copy link

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 #839

Signed-off-by: Dave Tucker [email protected]

@dave-tucker
Copy link
Author

@bradrydzewski looks like CI may be having some issues....

@bradrydzewski
Copy link

@dave-tucker I just pushed a new yaml that runs apt-get update before installing packages, which fixed the issue

// setup configuration
config := Config{Image: image}
host := HostConfig{}
host.NetworkMode = "host"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm definitely not an expert in Docker networking, but their documentation indicates this should be used with caution. What security implications are there? Could someone issue a pull request that alters my yaml and do bad things to my test.drone.io server?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using --net=host all ports are made available to the host system and an application can see/use then hosts network adapters.

Therefore we only launch the services this way when:

  • This is not a PR
  • The user has this in their YAML:
docker:
  net: host

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
Copy link
Author

Closing this one due to lack of activity

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 this pull request may close these issues.

Services do not operate correctly when docker net host option is specified
2 participants