Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
a579e9e2
Kaydet (Commit)
a579e9e2
authored
Ock 09, 2019
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove use_config_proxy from exec. Add use_config_proxy docs to DockerClient
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
1073b736
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
20 deletions
+29
-20
Jenkinsfile
Jenkinsfile
+1
-1
exec_api.py
docker/api/exec_api.py
+1
-9
containers.py
docker/models/containers.py
+8
-8
images.py
docker/models/images.py
+4
-0
models_containers_test.py
tests/integration/models_containers_test.py
+13
-0
models_containers_test.py
tests/unit/models_containers_test.py
+2
-2
No files found.
Jenkinsfile
Dosyayı görüntüle @
a579e9e2
...
@@ -91,7 +91,7 @@ def runTests = { Map settings ->
...
@@ -91,7 +91,7 @@ def runTests = { Map settings ->
--network ${testNetwork} \\
--network ${testNetwork} \\
--volumes-from ${dindContainerName} \\
--volumes-from ${dindContainerName} \\
${testImage} \\
${testImage} \\
py.test -v -rxs
tests/integration
py.test -v -rxs
--cov=docker tests/
"""
"""
}
finally
{
}
finally
{
sh
"""
sh
"""
...
...
docker/api/exec_api.py
Dosyayı görüntüle @
a579e9e2
...
@@ -8,8 +8,7 @@ class ExecApiMixin(object):
...
@@ -8,8 +8,7 @@ class ExecApiMixin(object):
@utils.check_resource
(
'container'
)
@utils.check_resource
(
'container'
)
def
exec_create
(
self
,
container
,
cmd
,
stdout
=
True
,
stderr
=
True
,
def
exec_create
(
self
,
container
,
cmd
,
stdout
=
True
,
stderr
=
True
,
stdin
=
False
,
tty
=
False
,
privileged
=
False
,
user
=
''
,
stdin
=
False
,
tty
=
False
,
privileged
=
False
,
user
=
''
,
environment
=
None
,
workdir
=
None
,
detach_keys
=
None
,
environment
=
None
,
workdir
=
None
,
detach_keys
=
None
):
use_config_proxy
=
False
):
"""
"""
Sets up an exec instance in a running container.
Sets up an exec instance in a running container.
...
@@ -32,10 +31,6 @@ class ExecApiMixin(object):
...
@@ -32,10 +31,6 @@ class ExecApiMixin(object):
or `ctrl-<value>` where `<value>` is one of:
or `ctrl-<value>` where `<value>` is one of:
`a-z`, `@`, `^`, `[`, `,` or `_`.
`a-z`, `@`, `^`, `[`, `,` or `_`.
~/.docker/config.json is used by default.
~/.docker/config.json is used by default.
use_config_proxy (bool): If ``True``, and if the docker client
configuration file (``~/.docker/config.json`` by default)
contains a proxy configuration, the corresponding environment
variables will be set in the container being created.
Returns:
Returns:
(dict): A dictionary with an exec ``Id`` key.
(dict): A dictionary with an exec ``Id`` key.
...
@@ -55,9 +50,6 @@ class ExecApiMixin(object):
...
@@ -55,9 +50,6 @@ class ExecApiMixin(object):
if
isinstance
(
environment
,
dict
):
if
isinstance
(
environment
,
dict
):
environment
=
utils
.
utils
.
format_environment
(
environment
)
environment
=
utils
.
utils
.
format_environment
(
environment
)
if
use_config_proxy
:
environment
=
\
self
.
_proxy_configs
.
inject_proxy_environment
(
environment
)
data
=
{
data
=
{
'Container'
:
container
,
'Container'
:
container
,
...
...
docker/models/containers.py
Dosyayı görüntüle @
a579e9e2
...
@@ -144,8 +144,7 @@ class Container(Model):
...
@@ -144,8 +144,7 @@ class Container(Model):
def
exec_run
(
self
,
cmd
,
stdout
=
True
,
stderr
=
True
,
stdin
=
False
,
tty
=
False
,
def
exec_run
(
self
,
cmd
,
stdout
=
True
,
stderr
=
True
,
stdin
=
False
,
tty
=
False
,
privileged
=
False
,
user
=
''
,
detach
=
False
,
stream
=
False
,
privileged
=
False
,
user
=
''
,
detach
=
False
,
stream
=
False
,
socket
=
False
,
environment
=
None
,
workdir
=
None
,
demux
=
False
,
socket
=
False
,
environment
=
None
,
workdir
=
None
,
demux
=
False
):
use_config_proxy
=
False
):
"""
"""
Run a command inside this container. Similar to
Run a command inside this container. Similar to
``docker exec``.
``docker exec``.
...
@@ -168,10 +167,6 @@ class Container(Model):
...
@@ -168,10 +167,6 @@ class Container(Model):
``{"PASSWORD": "xxx"}``.
``{"PASSWORD": "xxx"}``.
workdir (str): Path to working directory for this exec session
workdir (str): Path to working directory for this exec session
demux (bool): Return stdout and stderr separately
demux (bool): Return stdout and stderr separately
use_config_proxy (bool): If ``True``, and if the docker client
configuration file (``~/.docker/config.json`` by default)
contains a proxy configuration, the corresponding environment
variables will be set in the command's environment.
Returns:
Returns:
(ExecResult): A tuple of (exit_code, output)
(ExecResult): A tuple of (exit_code, output)
...
@@ -190,7 +185,7 @@ class Container(Model):
...
@@ -190,7 +185,7 @@ class Container(Model):
resp
=
self
.
client
.
api
.
exec_create
(
resp
=
self
.
client
.
api
.
exec_create
(
self
.
id
,
cmd
,
stdout
=
stdout
,
stderr
=
stderr
,
stdin
=
stdin
,
tty
=
tty
,
self
.
id
,
cmd
,
stdout
=
stdout
,
stderr
=
stderr
,
stdin
=
stdin
,
tty
=
tty
,
privileged
=
privileged
,
user
=
user
,
environment
=
environment
,
privileged
=
privileged
,
user
=
user
,
environment
=
environment
,
workdir
=
workdir
,
use_config_proxy
=
use_config_proxy
,
workdir
=
workdir
,
)
)
exec_output
=
self
.
client
.
api
.
exec_start
(
exec_output
=
self
.
client
.
api
.
exec_start
(
resp
[
'Id'
],
detach
=
detach
,
tty
=
tty
,
stream
=
stream
,
socket
=
socket
,
resp
[
'Id'
],
detach
=
detach
,
tty
=
tty
,
stream
=
stream
,
socket
=
socket
,
...
@@ -682,6 +677,7 @@ class ContainerCollection(Collection):
...
@@ -682,6 +677,7 @@ class ContainerCollection(Collection):
For example:
For example:
``{"Name": "on-failure", "MaximumRetryCount": 5}``
``{"Name": "on-failure", "MaximumRetryCount": 5}``
runtime (str): Runtime to use with this container.
security_opt (:py:class:`list`): A list of string values to
security_opt (:py:class:`list`): A list of string values to
customize labels for MLS systems, such as SELinux.
customize labels for MLS systems, such as SELinux.
shm_size (str or int): Size of /dev/shm (e.g. ``1G``).
shm_size (str or int): Size of /dev/shm (e.g. ``1G``).
...
@@ -713,6 +709,10 @@ class ContainerCollection(Collection):
...
@@ -713,6 +709,10 @@ class ContainerCollection(Collection):
tty (bool): Allocate a pseudo-TTY.
tty (bool): Allocate a pseudo-TTY.
ulimits (:py:class:`list`): Ulimits to set inside the container,
ulimits (:py:class:`list`): Ulimits to set inside the container,
as a list of :py:class:`docker.types.Ulimit` instances.
as a list of :py:class:`docker.types.Ulimit` instances.
use_config_proxy (bool): If ``True``, and if the docker client
configuration file (``~/.docker/config.json`` by default)
contains a proxy configuration, the corresponding environment
variables will be set in the container being built.
user (str or int): Username or UID to run commands as inside the
user (str or int): Username or UID to run commands as inside the
container.
container.
userns_mode (str): Sets the user namespace mode for the container
userns_mode (str): Sets the user namespace mode for the container
...
@@ -737,7 +737,6 @@ class ContainerCollection(Collection):
...
@@ -737,7 +737,6 @@ class ContainerCollection(Collection):
volumes_from (:py:class:`list`): List of container names or IDs to
volumes_from (:py:class:`list`): List of container names or IDs to
get volumes from.
get volumes from.
working_dir (str): Path to the working directory.
working_dir (str): Path to the working directory.
runtime (str): Runtime to use with this container.
Returns:
Returns:
The container logs, either ``STDOUT``, ``STDERR``, or both,
The container logs, either ``STDOUT``, ``STDERR``, or both,
...
@@ -952,6 +951,7 @@ RUN_CREATE_KWARGS = [
...
@@ -952,6 +951,7 @@ RUN_CREATE_KWARGS = [
'stdin_open'
,
'stdin_open'
,
'stop_signal'
,
'stop_signal'
,
'tty'
,
'tty'
,
'use_config_proxy'
,
'user'
,
'user'
,
'volume_driver'
,
'volume_driver'
,
'working_dir'
,
'working_dir'
,
...
...
docker/models/images.py
Dosyayı görüntüle @
a579e9e2
...
@@ -258,6 +258,10 @@ class ImageCollection(Collection):
...
@@ -258,6 +258,10 @@ class ImageCollection(Collection):
platform (str): Platform in the format ``os[/arch[/variant]]``.
platform (str): Platform in the format ``os[/arch[/variant]]``.
isolation (str): Isolation technology used during build.
isolation (str): Isolation technology used during build.
Default: `None`.
Default: `None`.
use_config_proxy (bool): If ``True``, and if the docker client
configuration file (``~/.docker/config.json`` by default)
contains a proxy configuration, the corresponding environment
variables will be set in the container being built.
Returns:
Returns:
(tuple): The first item is the :py:class:`Image` object for the
(tuple): The first item is the :py:class:`Image` object for the
...
...
tests/integration/models_containers_test.py
Dosyayı görüntüle @
a579e9e2
...
@@ -163,6 +163,19 @@ class ContainerCollectionTest(BaseIntegrationTest):
...
@@ -163,6 +163,19 @@ class ContainerCollectionTest(BaseIntegrationTest):
assert
logs
[
0
]
==
b
'hello
\n
'
assert
logs
[
0
]
==
b
'hello
\n
'
assert
logs
[
1
]
==
b
'world
\n
'
assert
logs
[
1
]
==
b
'world
\n
'
def
test_run_with_proxy_config
(
self
):
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
client
.
api
.
_proxy_configs
=
docker
.
utils
.
proxy
.
ProxyConfig
(
ftp
=
'sakuya.jp:4967'
)
out
=
client
.
containers
.
run
(
'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
def
test_get
(
self
):
def
test_get
(
self
):
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
container
=
client
.
containers
.
run
(
"alpine"
,
"sleep 300"
,
detach
=
True
)
container
=
client
.
containers
.
run
(
"alpine"
,
"sleep 300"
,
detach
=
True
)
...
...
tests/unit/models_containers_test.py
Dosyayı görüntüle @
a579e9e2
...
@@ -416,7 +416,7 @@ class ContainerTest(unittest.TestCase):
...
@@ -416,7 +416,7 @@ class ContainerTest(unittest.TestCase):
client
.
api
.
exec_create
.
assert_called_with
(
client
.
api
.
exec_create
.
assert_called_with
(
FAKE_CONTAINER_ID
,
"echo hello world"
,
stdout
=
True
,
stderr
=
True
,
FAKE_CONTAINER_ID
,
"echo hello world"
,
stdout
=
True
,
stderr
=
True
,
stdin
=
False
,
tty
=
False
,
privileged
=
True
,
user
=
''
,
environment
=
None
,
stdin
=
False
,
tty
=
False
,
privileged
=
True
,
user
=
''
,
environment
=
None
,
workdir
=
None
,
use_config_proxy
=
False
,
workdir
=
None
,
)
)
client
.
api
.
exec_start
.
assert_called_with
(
client
.
api
.
exec_start
.
assert_called_with
(
FAKE_EXEC_ID
,
detach
=
False
,
tty
=
False
,
stream
=
True
,
socket
=
False
,
FAKE_EXEC_ID
,
detach
=
False
,
tty
=
False
,
stream
=
True
,
socket
=
False
,
...
@@ -430,7 +430,7 @@ class ContainerTest(unittest.TestCase):
...
@@ -430,7 +430,7 @@ class ContainerTest(unittest.TestCase):
client
.
api
.
exec_create
.
assert_called_with
(
client
.
api
.
exec_create
.
assert_called_with
(
FAKE_CONTAINER_ID
,
"docker ps"
,
stdout
=
True
,
stderr
=
True
,
FAKE_CONTAINER_ID
,
"docker ps"
,
stdout
=
True
,
stderr
=
True
,
stdin
=
False
,
tty
=
False
,
privileged
=
True
,
user
=
''
,
environment
=
None
,
stdin
=
False
,
tty
=
False
,
privileged
=
True
,
user
=
''
,
environment
=
None
,
workdir
=
None
,
use_config_proxy
=
False
,
workdir
=
None
,
)
)
client
.
api
.
exec_start
.
assert_called_with
(
client
.
api
.
exec_start
.
assert_called_with
(
FAKE_EXEC_ID
,
detach
=
False
,
tty
=
False
,
stream
=
False
,
socket
=
False
,
FAKE_EXEC_ID
,
detach
=
False
,
tty
=
False
,
stream
=
False
,
socket
=
False
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment