I use Docker Toolbox on Windows 7 in a corporate environment. My workflow requires pulling containers from one artifactory and pushing them to a different one (eg. external and internal). Each artifactory requires a different proxy to access it. Is there a way to configure Docker daemon to select proxy based on a URL? Or, if not, what else can I do to make this work?
Related Questions in DOCKER
- php Variable name must change in for loop
- register_shutdown_function is not getting called
- Query returning zero rows despite entries existing
- Retrieving *number* pages by page id
- Automatically closing tags in form input?
- How to resize images with PHP PARSE SDK
- how to send email from localhost using codeigniter?
- Mariadb max Error while sending QUERY packet PID
- Multiusers login redirect different page in php
- Imaginary folder when I use "DirectoryIterator" in PHP?
Related Questions in HTTP-PROXY
- php Variable name must change in for loop
- register_shutdown_function is not getting called
- Query returning zero rows despite entries existing
- Retrieving *number* pages by page id
- Automatically closing tags in form input?
- How to resize images with PHP PARSE SDK
- how to send email from localhost using codeigniter?
- Mariadb max Error while sending QUERY packet PID
- Multiusers login redirect different page in php
- Imaginary folder when I use "DirectoryIterator" in PHP?
Related Questions in DOCKER-TOOLBOX
- php Variable name must change in for loop
- register_shutdown_function is not getting called
- Query returning zero rows despite entries existing
- Retrieving *number* pages by page id
- Automatically closing tags in form input?
- How to resize images with PHP PARSE SDK
- how to send email from localhost using codeigniter?
- Mariadb max Error while sending QUERY packet PID
- Multiusers login redirect different page in php
- Imaginary folder when I use "DirectoryIterator" in PHP?
Related Questions in HTTPS-PROXY-AGENT
- php Variable name must change in for loop
- register_shutdown_function is not getting called
- Query returning zero rows despite entries existing
- Retrieving *number* pages by page id
- Automatically closing tags in form input?
- How to resize images with PHP PARSE SDK
- how to send email from localhost using codeigniter?
- Mariadb max Error while sending QUERY packet PID
- Multiusers login redirect different page in php
- Imaginary folder when I use "DirectoryIterator" in PHP?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Since, as Pierre B. mentioned, Docker daemon does not support URL-based proxy selection, the solution is to point it to a local proxy configured to select the proper upstream proxy based on the URL.
While any HTTP[S] proxy capable of upstream selection would do, (pac4cli project being particularly interesting for it's advertised capability to select the upstream based on proxy-auto-discovery protocol used by most Web browsers a in corporate setting), I've chosen to use tinyproxy, as more mature and light-weight solution. Furthermore, I've decided to run my proxy inside the
docker-machine
VM in order to simplify it's deployment and make sure the proxy is always running when the Docker daemon needs it.Below are the steps I used to set up my system. I'm especially grateful to phoenix for providing steps to set up Docker Toolbox on Windows behind a corporate proxy, and will borrow heavily from that answer.
From this point on I will assume either Docker Quickstart Terminal or GitBash, with docker in the
PATH
, as your command line console and that "username" is your Windows user name.Step 1: Build
tinyproxy
on your target platformBegin by pulling a clean Linux distribution, I used CentOS, and run
bash
inside it:Next, install the tools we'll need:
After that we pull the latest release of Tinyproxy from it's GitHub repository and extract it inside root's home directory (at the time of this writing the latest release was 1.10.0):
Now let's configure and build it:
While
--enable-upstream
is obviously required, disabling other default features is optional but a good practice. To make sure it actually works run:You should see something like:
We exit the container by pressing Ctrl+D and copy the executable to a special folder location accessible from the
docker-machine
VM:Substitute "username" with your Windows user name. Please note that double slash —
//
before "root" is required to disable MINGW path conversion.Now we can delete the container:
Step 2: Point docker daemon to a local proxy port
Choose a TCP port number to run the proxy on. This can be any port that is not in use on the
docker-machine
VM. I will use number 8618 in this example.First, let's delete the existing default Docker VM:
WARNING: This will permanently erase all currently stored containers and images
Next, we re-create the default machine setting
HTTP_PROXY
andHTTPS_PROXY
environment variables to the local host and the port we selected, and then refresh our shell environment:Optionally, we could also set
NO_PROXY
environment variable to list hosts and/or wildcards (separated by;
) to which the daemon should connect directly, bypassing the proxy.Step 3: Set up
tinyproxy
insidedocker-machine
VMFirst, we will create two files in the
/c/Users/username
directory (this is where ourtinyproxy
binary should reside after Step 1 above) and then we'll copy them to the VM.The first file is
tinyproxy.conf
, the exact syntax is documented on the Tinyproxy website, but the example below should have all the settings need:In the example above:
http://proxy1.corp.example.com:80
will be used to connect to URLs that end with "foo.example.com", such ashttp://www.foo.example.com
http://proxy2.corp.example.com:80
will be used to connect to URLs that end with "bar.example.com", such ashttp://www.bar.example.com
, andhttp://proxy.corp.example.com:80
will be used to connect all other URLsIt is also possible to match exact host names, IP addresses, subnets and hosts without domains.
The second file is as the shell script that will launch the proxy, its name must be
bootlocal.sh
:Now, let's connect to the docker VM, get root, and switch to boot2docker directory:
Next, we'll copy all three files over and a set their permissions:
Exit VM session by pressing Ctrl+D twice and restart it:
That's it! Now
docker
should be able pull and push images from different URLs automatically selecting the right proxy server.