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

Examples on how to use comcast on a specific container #1

Open
beenanner opened this issue Jun 30, 2016 · 5 comments
Open

Examples on how to use comcast on a specific container #1

beenanner opened this issue Jun 30, 2016 · 5 comments

Comments

@beenanner
Copy link

Would it be possible to run this from within the container that you want to throttle? That way the network throttling is handled by the container itself?

@hugorodrigues
Copy link

I'm trying to do exactly this.
@beenanner have you been able to make it work?

@aidanhs
Copy link
Member

aidanhs commented Aug 10, 2016

Hmm, if you want to do this then you'll need to give your container --privileged or figure out the appropriate capabilities to permit reconfiguring network interfaces. You'll also need to make sure you have the appropriate commands installed for comcast to use in the container - on Ubuntu, the iproute2 package gives tc and iptables gives iptables.

Some other notes:

  • you don't need to use this repo (since it just adds the container id to network interface lookup, which won't be necessary any more), you can use the upstream 'comcast' repository
  • if you have a specific condition you always want to apply at container startup, you can use the dry-run mode of comcast to print out the list of commands that create that condition and then copy and paste them into a shell script in the container - comcast is just a convenient interface on top of this

@hugorodrigues
Copy link

hugorodrigues commented Aug 11, 2016

@aidanhs Thanks for your time and thoughts. Going to try again using the --privileged flag. After some researching I think the --cap-add=NET_ADMIN flag can also help.

I will keep you guys posted :)

@aidanhs
Copy link
Member

aidanhs commented Sep 4, 2017

I've written a bit more in tylertreat/comcast#48 (comment), but the upshot is that it seems a bit unfortunate to give random containers extra network permissions and bloat them with more dependencies.

If you wanted to get serious about it, I'd build a simple REST API on top of docker-comcast and expose it as a docker service so containers can request throttling - no extra perms or dependencies in your containers. Of course, this may be a bit heavy if you just want one container to self-configure.

I'll ponder on making a REST API myself and adding a technique talking about exposing it as a service in the next edition of the book - is this something people would find useful? I'm also interested whether people on this issue are readers or have found this repo some other way - either way, I'm glad people are finding it useful!

@rajatbarman
Copy link

My use case is to test a webrtc based video conferencing application, with comcast I am able to do throttling of UDP packets for my whole system, but what I want is to have different network conditions for each app instance. I want to see how my application behaves when one of the participant's network is unstable, with comcast all participant's network is throttled because of how it works. If I could containerize, I can fulfill my use case.

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

No branches or pull requests

4 participants