-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Support Overlay Network #337
Conversation
If PR merged, missing Circle CI container creation with flag --net=host to deal with network differents of |
Can you explain the --net=host requirement better? That shouldn't be
necessary for an overlay network since the proxy should also be on the
overlay network.
|
With the new overlay network and the --x-networking docker-compose flag (currently beta - 1.5), every application are isolated in specific network. Containers into |
Based on the Getting started with multi-host networking document, it seems like they're recommending I think this should be documented in its own section of the readme instead of adding |
Okay, @md5 Do you want propose a README text block to insert ? |
I haven't really played around with overlay enough to write the section myself and I'm not sure when I'll get a chance to do so. Regarding |
I understand. The best solution could be an aggregation of namespace networks. I currently search a best solution. |
Currently, we can associate a container at many networks with Can be a best alternative at |
I agree the connecting explicitly to all the relevant networks is the best approach. It looks like support for doing this in a |
@md5 Please feedback for English language and content writing. |
@baptistedonaux I opened baptistedonaux#1 with my suggestions. One thing that updating the |
Looking closer at nginx-proxy/docker-gen#146, I don't think it actually does anything to help us figure out the container ID of the |
@md5 I was thinking at this feature. I try implement it and I come back to you. |
It looks like # awk -F/ '/cpu:/ { print $NF }' /proc/self/cgroup
7f72ffdf3089df475a9cfe459fd0ec3b0d214686e794887ca17bc1b32a6f995b
|
Update README wording for overlay networking
@md5 To retrieve current container name, I propose awk -F"-|\." '/1:/ {print $3}' /proc/self/cgroup Then, get container's networks for current network requires to know current container name. So I propose two solutions:
type Docker struct {
Name string
NumContainers int
NumImages int
Version string
ApiVersion string
GoVersion string
OperatingSystem string
Architecture string
+ CurrentContainerName string
}
func getCurrentContainerName() (string, error); In two cases, docker-gen requires a new feature implementation (or I need help). |
@md5 What do you think of my propositions ? |
@baptistedonaux I don't think that using I think adding the current container id (or name) to the |
@md5 I try too on a git branch to prepare the next implementation (matches between proxy container and networks). |
I have implemented a parser for baptistedonaux/docker-gen@dc155e1 I wait your implementation or your feedback. |
I commented on the commit. Perhaps @jwilder can take a look when he has a minute. |
I propose this PR nginx-proxy/docker-gen#158 |
@baptistedonaux I got good and bad news, I found the issue: $ docker run nginx cat /proc/self/cgroup
11:name=systemd:/user/1002.user/4.session/lxc/box185
10:hugetlb:/user/1002.user/4.session/lxc/box185
9:perf_event:/user/1002.user/4.session/lxc/box185
8:blkio:/user/1002.user/4.session/lxc/box185
7:freezer:/user/1002.user/4.session/lxc/box185
6:devices:/user/1002.user/4.session/lxc/box185
5:memory:/user/1002.user/4.session/lxc/box185
4:cpuacct:/user/1002.user/4.session/lxc/box185
3:cpu:/user/1002.user/4.session/lxc/box185
2:cpuset:/user/1002.user/4.session/lxc/box185 The container ID doesn't get exposed by Circle-CI through # echo $HOSTNAME
991c24d485ec
# cat /proc/self/mountinfo
664 652 0:36 /box1259/rootfs/var/lib/docker/btrfs/subvolumes/c9e1b36a7b2c52348f03888a6f05599db02a301f2f6a59b65fe6afeb189c3a02 / rw,nodev,noatime - btrfs /dev/xvdh rw,nodatasum,nodatacow,ssd,space_cache
665 664 0:271 / /proc rw,nodev,relatime - proc proc rw
666 664 0:272 / /dev rw,nosuid,nodev - tmpfs tmpfs rw,mode=755,uid=231072,gid=231072
667 666 0:273 / /dev/pts rw,relatime - devpts devpts rw,gid=231077,mode=620,ptmxmode=666
668 664 0:274 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime - tmpfs tmpfs rw,mode=755,uid=231072,gid=231072
669 664 0:36 /box1259/rootfs/var/lib/docker/containers/991c24d485ec3a13198b101a98152228194305243f10266fd0215d0689e4bb22/resolv.conf /etc/resolv.conf rw,nodev,noatime - btrfs /dev/xvdh rw,nodatasum,nodatacow,ssd,space_cache
670 664 0:36 /box1259/rootfs/var/lib/docker/containers/991c24d485ec3a13198b101a98152228194305243f10266fd0215d0689e4bb22/hostname /etc/hostname rw,nodev,noatime - btrfs /dev/xvdh rw,nodatasum,nodatacow,ssd,space_cache
671 664 0:36 /box1259/rootfs/var/lib/docker/containers/991c24d485ec3a13198b101a98152228194305243f10266fd0215d0689e4bb22/hosts /etc/hosts rw,nodev,noatime - btrfs /dev/xvdh rw,nodatasum,nodatacow,ssd,space_cache
672 666 0:269 / /dev/shm rw,nosuid,nodev,noexec,relatime - tmpfs shm rw,size=65536k,uid=231072,gid=231072
673 666 0:46 / /dev/mqueue rw,nosuid,nodev,noexec,relatime - mqueue mqueue rw
674 666 0:5 /null /dev/null rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
675 666 0:5 /zero /dev/zero rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
676 666 0:5 /full /dev/full rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
677 666 0:5 /tty /dev/tty rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
678 666 0:5 /urandom /dev/urandom rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
679 666 0:5 /random /dev/random rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
681 665 0:5 /null /proc/kcore rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
682 665 0:5 /null /proc/latency_stats rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
683 665 0:5 /null /proc/timer_stats rw,relatime - devtmpfs udev rw,size=30904560k,nr_inodes=7726140,mode=755
# grep "$HOSTNAME" /proc/self/mountinfo | head -n1 | perl -n -e '/([0-9a-f]{64})/ && print "$1\n"'
991c24d485ec3a13198b101a98152228194305243f10266fd0215d0689e4bb22 I would suggest adapting docker-gen to try to find the ID in |
@pitkley I think On my host, I have |
@baptistedonaux |
Keep in mind that CircleCI compile their own custom docker engine binary. Make sure that issue isn't specific to CircleCI |
See thomasleveil@c85839b for switching back to TravisCI (if it helps) |
@thomasleveil Thanks for the input on that! I guess that this is rather specific, because I haven't heard of Anyway, this would probably be a "custom-tailored" solution to get CI happy, with the side-effect of supporting the low percentage of other users who might run a special build of Docker that doesn't expose the ID through the cgroups directly. While switching to Travis is an option (and a quick test shows that the cgroups are available), I'm not sure if @jwilder would be too happy about switching. I think that this is @jwilder's call: "monkeypatch" docker-gen such that it tries to find the container ID elsewhere (like |
@pitkley True, only @jwilder can switch to Travis CI. Neverheless, @thomasleveil was right because the last Travis built successful. https://travis-ci.org/thomasleveil/nginx-proxy/builds/95239874 |
@baptistedonaux Furthermore, I have tried to build and test this PR, which worked too. So Travis-CI definitely seems like a viable option! 👍 |
I'm fine switching to Travis CI. This project used to use it as well, but switched to Circle CI when the test suite was added. See: #246 for why. |
@jwilder Great, Travais fail seems solved. @thomasleveil @pitkley Somebody to propose a PR (switch Circle to Travis) or I add this changement in current PR. |
@jwilder Travis test works |
@@ -73,6 +73,7 @@ load test_helpers | |||
-v /var/run/docker.sock:/tmp/docker.sock:ro \ | |||
-v $BATS_TEST_DIRNAME/../nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro \ | |||
--volumes-from bats-nginx \ | |||
--expose 80 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive me if this is covered in the previous comments, but why is this change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@md5 See this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@baptistedonaux any updates? Can't wait for it 😊 |
I wait a feedback of @jwilder to advance this PR. /cc @md5 @pitkley @nikashitsa |
Thanks @baptistedonaux! |
does that mean that it's possible to use with v2 syntax? |
It's a feature only available with the v2 syntax. In v1, it's impossible to manage networks. |
docker-compose --x-networking up -d
)