Issue:
When you working on docker, you may behind corporate proxy, which means that your docker container cannot access the Internet.
Solution:
Config Http Proxy for Docker Engine, so that all the container running on it could have the Internet accessing capability automatically.
Add following code to the config file ~/.docker/config.json (
For windows, this file would be at C:\Users\)
"proxies": {
"default": {
"httpProxy": "http://user:[email protected]:3128",
"httpsProxy": "http://user:[email protected]:3128",
"noProxy": "http://user:[email protected]:3128",
"ftpProxy": "http://user:[email protected]:3128"
},
"https://manager1.mycorp.example.com:2377": {
"httpProxy": "http://user:[email protected]:3128",
"httpsProxy": "http://user:[email protected]:3128"
},
}
Full config example is here:
{
"HttpHeaders": {
"MyHeader": "MyValue"
},
"psFormat": "table {
{.ID}}\\t{
{.Image}}\\t{
{.Command}}\\t{
{.Labels}}",
"imagesFormat": "table {
{.ID}}\\t{
{.Repository}}\\t{
{.Tag}}\\t{
{.CreatedAt}}",
"pluginsFormat": "table {
{.ID}}\t{
{.Name}}\t{
{.Enabled}}",
"statsFormat": "table {
{.Container}}\t{
{.CPUPerc}}\t{
{.MemUsage}}",
"servicesFormat": "table {
{.ID}}\t{
{.Name}}\t{
{.Mode}}",
"secretFormat": "table {
{.ID}}\t{
{.Name}}\t{
{.CreatedAt}}\t{
{.UpdatedAt}}",
"configFormat": "table {
{.ID}}\t{
{.Name}}\t{
{.CreatedAt}}\t{
{.UpdatedAt}}",
"serviceInspectFormat": "pretty",
"nodesFormat": "table {
{.ID}}\t{
{.Hostname}}\t{
{.Availability}}",
"detachKeys": "ctrl-e,e",
"credsStore": "secretservice",
"credHelpers": {
"awesomereg.example.org": "hip-star",
"unicorn.example.com": "vcbait"
},
"stackOrchestrator": "kubernetes",
"plugins": {
"plugin1": {
"option": "value"
},
"plugin2": {
"anotheroption": "anothervalue",
"athirdoption": "athirdvalue"
}
},
"proxies": {
"default": {
"httpProxy": "http://user:[email protected]:3128",
"httpsProxy": "http://user:[email protected]:3128",
"noProxy": "http://user:[email protected]:3128",
"ftpProxy": "http://user:[email protected]:3128"
},
"https://manager1.mycorp.example.com:2377": {
"httpProxy": "http://user:[email protected]:3128",
"httpsProxy": "http://user:[email protected]:3128"
},
}
}
Reference:
https://docs.docker.com/engine/reference/commandline/cli
https://stackoverflow.com/questions/48272933/docker-at-windows-10-proxy-propagation-to-containers-not-working