Change use_config_proxy default value to True to match CLI behavior

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2019-05-01 20:47:41 -07:00
parent 836194c64f
commit 87ee18aa39
4 changed files with 16 additions and 14 deletions

View File

@ -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

View File

@ -1,13 +1,15 @@
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):
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``).

View File

@ -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)

View File

@ -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):
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