-
Notifications
You must be signed in to change notification settings - Fork 74
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 support for docker proxy #69
Conversation
Hi ! Good works, i'm going to test while you roasted me at implementing this. I'm currently using boot2docker, and it seems that, when you have vagrant-proxyconf which configure an /etc/profile.d/proxy.sh script, we just have to restart docker service, beacuse it'll use profile script. So Docker support will mostly depends on which Os and which service management is used (init, systemd, etc.) What do you think around that ? |
Thanks for your comment! I found /usr/local/etc/init.d/docker for boot2docker. It uses I will add this to my pull request, so I changed this pull request to 'Work In Progress'. |
Thanks a lot! Unfortunately I haven't had time to go through this yet, but hopefully have on Thursday. Anyway, the different behavior of guest OSs should be implemented through guest capabilities. This is a design mistake from my part early on. I haven't got into refactoring it on all action classes, but here we could move the logic to capability classes anyway. |
@tmatilai Thank you for your advice. If you give me a direction, i will try to move the logic. Can you give me hints or something? |
@dduportal I have added docker proxy config on boot2docker. Please check it. I think there are some kinds of implementations around booting of docker, we need to care all individuals.. |
I fixed a problem for |
@otahi thanks again for all the work. I've been buried with other things, but hope to recover a bit in a week. If this seems to work for people I guess I could merge this then and we can think about refactoring later. |
@tmatilai Thank you for your comment. I agree with your idea. |
+1 for this patch. I tested the plugin and it works nicely with our corporate http proxy. The only issue I found is that the docker service needs to be restarted manually to pick up the new configuration. |
@BugRoger Thank you for testing. |
@BugRoger @tmatilai I have added docker daemon restarting. I have checked this change with the following guests, and it works.
It works even if it is a first boot.
|
@otahi Does docker use |
I'll take a look behind my company proxy this week (under Cloudstack, and on Windows 7 x64). |
Hi, excuse the ruby's noob question but : how to compile and run the plugin ? I installed a basic container with ruby 2.0.0/gem from RVM :
Where i cloned the two repositories (tmatilai's one and otahi's one) into. Then i ran a bundle install into the repos, but what to do then ? I'm stuck, with no dev docs to begin with. |
You need to install the plugin in Vagrant. I assume you don't have your Vagrant inside of a docker container. This would do it on the vagrant host:
|
Well OK, i missed the rake release (didn't know where this tool was user in the build toolchain). Thanks for the response ! I'll give a shoot these days. (In fact, i use docker for sharing and reusing the compilation env => From git clone to rake release, all of that will be run into a container, ii's protable and versionnable. Then, i'll copy the generated artefacts to a physical host running vagrant, virtualbox, docker, etc... If i want to be tied to docker only, i can also test the plugin inside my container, with things like https://github.com/jpetazzo/dind, vagrant and only the docker provider :-) ) |
@johnbellone Docker just uses the http transport from Go's standard library. And that one doesn't care about the case of the env variables http://golang.org/src/pkg/net/http/transport.go#L102 |
Even though But you don't even need to use rake and system ruby, as you can just use Vagrant's embedded ruby environment. The instructions can be found in the wiki. |
@tmatilai thanks a lot, i missed there was a wiki, shame on me ! |
Under Mac OS 10.9.3 with boot2docker 1.0.0
First test with a local proxy (basic polipo image) works fine. I'll try under Windows Wednesday. Anyway, good job ! |
@johnbellone @BugRoger Thank you for your check and giving a reference.
Anyway, I have added unnecessary environments like If it is better to delete, I will modify like this. def docker_sed_script
<<-SED.gsub(/^\s+/, '')
/^export HTTP_PROXY=/ d
/^export HTTPS_PROXY=/ d
/^export FTP_PROXY=/ d
/^export NO_PROXY=/ d
/^export http_proxy=/ d
/^export https_proxy=/ d
/^export ftp_proxy=/ d
/^export no_proxy=/ d
SED
end ⬇️ def docker_sed_script
<<-SED.gsub(/^\s+/, '')
/^export HTTP_PROXY=/ d
/^export NO_PROXY=/ d
/^export http_proxy=/ d
/^export no_proxy=/ d
SED
end |
@dduportal Thank you for testing! I want to hear good news from you! 😄 |
I have deleted unused environment variables at d8755f4, and it still works on my environment. |
@otahi @tmatilai All working for me : company corporate proxy (dedicated physical appliance), serving only HTTP and HTTPS (FTP thru HTTP supported but no SSH over HTTPS). I installed the dev gem :
Adn then ran my custom boot2docker :
My config was a Windows 7 x64, with vagrant 1.6.2 It's all OK for me ! |
@dduportal Thank you for your time! That's nice! @tmatilai Can we merge this change? |
@otahi sure! I'll go through it once more and merge. But can't promise if I manage to do it today. |
Merged! Thanks to everyone involved! |
Thank you @tmatilai and everyone!! |
👍 |
Configure docker to use proxies if it is installed.
Docker daemon needs http_proxy environment when behind proxies in a docker config file as follows:
/etc/sysconfig/docker
/etc/default/docker
( < Ubuntu 14.04)/etc/default/docker.io
( >= Ubuntu 14.04 )/var/lib/boot2docker/profile
I could not find any official documents docker for proxy.
See following references.
docker issues 1852
Stack Overflow: Cannot download Docker images behind a proxy