Unverified Kaydet (Commit) e2c1c9ca authored tarafından Joffrey F's avatar Joffrey F Kaydeden (comit) GitHub

Merge pull request #2332 from docker/use_proxy_config_default

Change use_config_proxy default value to True to match CLI behavior
...@@ -20,7 +20,7 @@ class BuildApiMixin(object): ...@@ -20,7 +20,7 @@ class BuildApiMixin(object):
decode=False, buildargs=None, gzip=False, shmsize=None, decode=False, buildargs=None, gzip=False, shmsize=None,
labels=None, cache_from=None, target=None, network_mode=None, labels=None, cache_from=None, target=None, network_mode=None,
squash=None, extra_hosts=None, platform=None, isolation=None, squash=None, extra_hosts=None, platform=None, isolation=None,
use_config_proxy=False): use_config_proxy=True):
""" """
Similar to the ``docker build`` command. Either ``path`` or ``fileobj`` Similar to the ``docker build`` command. Either ``path`` or ``fileobj``
needs to be set. ``path`` can be a local path (to a directory needs to be set. ``path`` can be a local path (to a directory
......
import six
from datetime import datetime from datetime import datetime
import six
from .. import errors from .. import errors
from .. import utils from .. import utils
from ..constants import DEFAULT_DATA_CHUNK_SIZE from ..constants import DEFAULT_DATA_CHUNK_SIZE
from ..types import ( from ..types import CancellableStream
CancellableStream, ContainerConfig, EndpointConfig, HostConfig, from ..types import ContainerConfig
NetworkingConfig from ..types import EndpointConfig
) from ..types import HostConfig
from ..types import NetworkingConfig
class ContainerApiMixin(object): class ContainerApiMixin(object):
...@@ -222,7 +224,7 @@ class ContainerApiMixin(object): ...@@ -222,7 +224,7 @@ class ContainerApiMixin(object):
mac_address=None, labels=None, stop_signal=None, mac_address=None, labels=None, stop_signal=None,
networking_config=None, healthcheck=None, networking_config=None, healthcheck=None,
stop_timeout=None, runtime=None, stop_timeout=None, runtime=None,
use_config_proxy=False): use_config_proxy=True):
""" """
Creates a container. Parameters are similar to those for the ``docker Creates a container. Parameters are similar to those for the ``docker
run`` command except it doesn't support the attach options (``-a``). run`` command except it doesn't support the attach options (``-a``).
...@@ -414,7 +416,7 @@ class ContainerApiMixin(object): ...@@ -414,7 +416,7 @@ class ContainerApiMixin(object):
if use_config_proxy: if use_config_proxy:
environment = self._proxy_configs.inject_proxy_environment( environment = self._proxy_configs.inject_proxy_environment(
environment environment
) ) or None
config = self.create_container_config( config = self.create_container_config(
image, command, hostname, user, detach, stdin_open, tty, image, command, hostname, user, detach, stdin_open, tty,
......
...@@ -17,7 +17,6 @@ class ExecTest(BaseAPIIntegrationTest): ...@@ -17,7 +17,6 @@ class ExecTest(BaseAPIIntegrationTest):
container = self.client.create_container( container = self.client.create_container(
BUSYBOX, 'cat', detach=True, stdin_open=True, BUSYBOX, 'cat', detach=True, stdin_open=True,
use_config_proxy=True,
) )
self.client.start(container) self.client.start(container)
self.tmp_containers.append(container) self.tmp_containers.append(container)
......
...@@ -2,10 +2,13 @@ import os ...@@ -2,10 +2,13 @@ import os
import tempfile import tempfile
import threading import threading
import docker
import pytest import pytest
from .base import BaseIntegrationTest, TEST_API_VERSION
from ..helpers import random_name, requires_api_version import docker
from ..helpers import random_name
from ..helpers import requires_api_version
from .base import BaseIntegrationTest
from .base import TEST_API_VERSION
class ContainerCollectionTest(BaseIntegrationTest): class ContainerCollectionTest(BaseIntegrationTest):
...@@ -174,9 +177,7 @@ class ContainerCollectionTest(BaseIntegrationTest): ...@@ -174,9 +177,7 @@ class ContainerCollectionTest(BaseIntegrationTest):
ftp='sakuya.jp:4967' ftp='sakuya.jp:4967'
) )
out = client.containers.run( out = client.containers.run('alpine', 'sh -c "env"')
'alpine', 'sh -c "env"', use_config_proxy=True
)
assert b'FTP_PROXY=sakuya.jp:4967\n' in out assert b'FTP_PROXY=sakuya.jp:4967\n' in out
assert b'ftp_proxy=sakuya.jp:4967\n' in out assert b'ftp_proxy=sakuya.jp:4967\n' in out
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment