Comments (8)
Hey thanks for the issue! I haven't had a chance to try with the native driver. PRs are much appreciated. If your fixes easily break down into smaller chunks, that is of course easier to review. Otherwise a single PR is fine, it might just take me a little longer to review and merge.
from blockade.
Bringing this over to the open issue - my POC uses nsenter to dig into container interface peer_ifindex values and find their pairs.
Do you have a better way of doing this?
from blockade.
Hmm your approach sounds interesting. I'm not sure if my approach is better, or even very portable. I've found that at least on ubuntu trusty you can link the container process' net ns into /var/run/netns
, and then use ip netns exec
to execute the needed commands in that netns. That way you don't even need to find the interface name. So for example:
# ln -sf /proc/22196/ns/net /var/run/netns/XXX # 22196 is the container PID dug out of docker inspect
# ip netns exec XXX tc qdisc show dev eth0
qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
So I was thinking we could create this link for each container when we start it, using something like blockade_id-container_id
for the name. However I'm not at all sure how portable this will be. I'd love to see your POC, if you want to push a branch up.
By the way, one goal I do have is to refactor all the commands to optionally run through SSH (via paramiko), to actually support boot2docker. So that goal should inform the approach here.
from blockade.
As of right now you can have a look at https://github.com/docker-in-practice/docker-blockade or dockerinpractice/blockade
from the docker hub. I'm using them in Docker in Practice - requiring the readers to use an old version of Docker tends to not impress :)
Taking a snippet from the book:
$ cat >blockade.yml <<'EOF'
containers:
server:
image: ubuntu:14.04.2
command: /bin/sleep infinity
expose: [10000]
client1:
image: ubuntu:14.04.2
command: sh -c "ping $SERVER_PORT_10000_TCP_ADDR"
links: ["server"]
client2:
image: ubuntu:14.04.2
command: sh -c "ping $SERVER_PORT_10000_TCP_ADDR"
links: ["server"]
network:
flaky: 50%
slow: 100ms
EOF
$ IMG=dockerinpractice/blockade
$ docker pull $IMG
latest: Pulling from dockerinpractice/blockade
[...]
Status: Downloaded newer image for dockerinpractice/blockade:latest
$ alias blockade="docker run --rm --pid=host --privileged -v \$PWD:/blockade -v /var/run/docker.sock:/var/run/docker.sock $IMG"
$ blockade up
NODE CONTAINER ID STATUS IP NETWORK PARTITION
client1 f9b01fc7daee UP 172.17.0.7 NORMAL
client2 9aa8a905fa78 UP 172.17.0.8 NORMAL
server eca4cdb9c94c UP 172.17.0.6 NORMAL
The crucial part in the repo is the .patch file, specifically https://github.com/docker-in-practice/docker-blockade/blob/master/docker-blockade.patch#L101. It runs ethtool in the context of the container network, extracts the peer_ifindex and chooses the vethxxx device based on that.
I wasn't such a fan of the symlink approach when I was considering patches for the book because it's another thing to have to clean up.
from blockade.
Iām not sure if this is the right place to ask, but are there any chance blockade is going to support native drivers, since lxc one is deprecated already and will be removed since docker-1.10 (https://github.com/docker/docker/blob/master/docs/misc/deprecated.md#lxc-built-in-exec-driver)
from blockade.
I haven't forgotten about this, but I just haven't had much time to work on blockade lately. I hope to finish this up in December, probably using @aidanhs's approach above. In the meantime I'd be quite happy to accept pull requests.
from blockade.
Just as a note, I dug around in the ethtool source a bit for the docker-in-practice repo and observed that getting peer_ifindex is actually not trivial operation, otherwise I'd have created a simple, tiny static binary for it which blockade could bundle. Since getting peer_ifindex may not actually possible in pure python, you may need to do this anyway.
However, this doesn't help on windows or osx, regardless of the method! I think I concluded that if you want blockade to work cross-platform, you need to make the tiny peer_ifindex binary and then start a privileged 'helper container' which you can insert the required tools into (i.e. created binary + nsenter) and work from there.
No need for paramiko/ssh.
from blockade.
This is resolved in the forthcoming blockade 0.2.0 release, thanks to contribution from @kongo2002. Blockade now works with the latest docker.
from blockade.
Related Issues (20)
- Use external UDN docker network HOT 1
- Improve logging
- Connection timeout
- Handle more than one connection at a time HOT 1
- multiple ports and networks in blockade.yml HOT 1
- UDP port expose support
- What would it take to add support for Docker Swarm please? HOT 1
- Networking with blockade - restrict communication HOT 4
- Is it possible to assign static IP address to the containers? HOT 1
- Is it possible to add a running container to blockade? HOT 1
- Blockade REST API Setup Parameters HOT 1
- net-tools is now a hard dependency HOT 2
- Error: a blockade already exists in here - you may want..
- How to use blockade API inside container HOT 1
- Support environment variables in volume names HOT 2
- Chaining of Commands e.g. flaky + slow HOT 5
- Blockade install via pip broken for mac users HOT 2
- A few questions...
- Proposing a PR to fix a few small typos
- Blockade unable to start after image re-build HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blockade.