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

Add a warning about plugins and the agent in docker #379

Merged
merged 4 commits into from
Feb 4, 2019

Conversation

lox
Copy link
Contributor

@lox lox commented Jan 30, 2019

This adds a really prominent warning about using the agent in docker and our plugins.

The issue at buildkite-plugins/docker-buildkite-plugin#61 provides some more context.

Copy link
Contributor

@harrietgrace harrietgrace left a comment

Choose a reason for hiding this comment

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

Sweet! I fixed some little spelling and punctuation bits, and put the github URL behind a link. Did you have particular feels about keeping that URL in full?

Copy link
Contributor

@toolmantim toolmantim left a comment

Choose a reason for hiding this comment

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

This is awesome! It’d be good to give people a really practical example, based on common setups.

@@ -15,9 +15,9 @@ You can run the Buildkite Agent inside a Docker container using the [`buildkite/

## 🚨 Incompatibilities with plugins

Whilst the agnt runs well in docker, there are presently some difficulties when combining your agent in a docker container and using many of our [plugins](https://buildkite.com/plugins). These can largely be mitigated by ensuring that the `builds-path` from the host is bind mounted into your agent container with the same path as on the host and having the buildkite-agent installed on the host so that it can be mounted into containers.
While the agent runs well in Docker, there are presently some difficulties when running an agent in a Docker container and using many of our [plugins](https://buildkite.com/plugins). These issues can largely be mitigated by ensuring that the `builds-path` from the host is bind mounted into your agent container with the same path as on the host, and having the `buildkite-agent` installed on the host so that it can be mounted into containers.
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like the last part of the paragraph could do with an explicit example of how to run the agent in a plugin-compatible way. For example (super rough and unchecked), a common configuration is:

docker run \
  # Make sure the build checkout dir exists on the host machine, not just the agent container
  -v /var/lib/buildkite/builds:/var/lib/buildkite/builds \
  # Make sure we use the same path in the container
  -e “BUILDKITE_BUILDS_PATH=/var/lib/buildkite/builds” \
  # Some Buildkite plugins, like the Docker plugin, mount the buildkite-agent binary into the job’s container to do artifact and meta-data
  -v “$(which buildkite-agent):/usr/local/bin/buildkite-agent” \
  # Let the agent run Docker commands, so people can use the Docker and Docker Compose Buildkite plugins
  -v “/var/run/docker.sock:/var/run/docker.sock” \
  buildkite/agent:3 start

People can then figure out how to do something like that using ECS/k8s etc if they need.

Should we also add a caveat that they should understand what container security protections they’re bypassing by setting these particular options?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow I really made a mess of english in that line huh.

I think your suggestion makes a heap of sense @toolmantim, that's where I was hoping to end up but wanted to chat about it a bit first.

@lox
Copy link
Contributor Author

lox commented Feb 4, 2019

@toolmantim I took some of your suggestions and included an example. I also shuffled things around a bit so that the caveats are around accessing docker within a build vs specifically plugins.

@toolmantim
Copy link
Contributor

Those changes look awesome @lox!

I think the issues justify the amount of words/attention we're giving it, and that people running big buildkite/agent Docker setups (especially on platforms like k8s and things) need to be aware of the path-of-least-pain when setting it up… otherwise it'll be developers discovering the pain points months later when they try to use one of our Docker plugins.

It's also a big motivator to have a better answer! 😁

@lox
Copy link
Contributor Author

lox commented Feb 4, 2019

Yup, I agree @toolmantim. Anything else before we ship it?

@toolmantim
Copy link
Contributor

Not from me, only @harrietgrace’s edits I think!

@harrietgrace
Copy link
Contributor

I updated a couple of little words, nothing major. Happy for it to go out! Awesome additions @lox 👏🏻 🚢🚀

@lox lox merged commit 9bf261a into master Feb 4, 2019
@lox lox deleted the add-warning-about-agent-in-docker-and-plugins branch February 4, 2019 22:32
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.

3 participants