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
161bfba9
Kaydet (Commit)
161bfba9
authored
Şub 16, 2017
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for storage_opt in host_config
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
7382eb18
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
1 deletion
+31
-1
container.py
docker/api/container.py
+2
-0
containers.py
docker/models/containers.py
+3
-0
containers.py
docker/types/containers.py
+6
-1
api_container_test.py
tests/integration/api_container_test.py
+16
-0
base.py
tests/integration/base.py
+4
-0
No files found.
docker/api/container.py
Dosyayı görüntüle @
161bfba9
...
@@ -549,6 +549,8 @@ class ContainerApiMixin(object):
...
@@ -549,6 +549,8 @@ class ContainerApiMixin(object):
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``).
storage_opt (dict): Storage driver options per container as a
key-value mapping.
sysctls (dict): Kernel parameters to set in the container.
sysctls (dict): Kernel parameters to set in the container.
tmpfs (dict): Temporary filesystems to mount, as a dictionary
tmpfs (dict): Temporary filesystems to mount, as a dictionary
mapping a path inside the container to options for that path.
mapping a path inside the container to options for that path.
...
...
docker/models/containers.py
Dosyayı görüntüle @
161bfba9
...
@@ -586,6 +586,8 @@ class ContainerCollection(Collection):
...
@@ -586,6 +586,8 @@ class ContainerCollection(Collection):
Default: ``False``.
Default: ``False``.
stop_signal (str): The stop signal to use to stop the container
stop_signal (str): The stop signal to use to stop the container
(e.g. ``SIGINT``).
(e.g. ``SIGINT``).
storage_opt (dict): Storage driver options per container as a
key-value mapping.
sysctls (dict): Kernel parameters to set in the container.
sysctls (dict): Kernel parameters to set in the container.
tmpfs (dict): Temporary filesystems to mount, as a dictionary
tmpfs (dict): Temporary filesystems to mount, as a dictionary
mapping a path inside the container to options for that path.
mapping a path inside the container to options for that path.
...
@@ -833,6 +835,7 @@ RUN_HOST_CONFIG_KWARGS = [
...
@@ -833,6 +835,7 @@ RUN_HOST_CONFIG_KWARGS = [
'restart_policy'
,
'restart_policy'
,
'security_opt'
,
'security_opt'
,
'shm_size'
,
'shm_size'
,
'storage_opt'
,
'sysctls'
,
'sysctls'
,
'tmpfs'
,
'tmpfs'
,
'ulimits'
,
'ulimits'
,
...
...
docker/types/containers.py
Dosyayı görüntüle @
161bfba9
...
@@ -117,7 +117,7 @@ class HostConfig(dict):
...
@@ -117,7 +117,7 @@ class HostConfig(dict):
oom_kill_disable
=
False
,
shm_size
=
None
,
sysctls
=
None
,
oom_kill_disable
=
False
,
shm_size
=
None
,
sysctls
=
None
,
tmpfs
=
None
,
oom_score_adj
=
None
,
dns_opt
=
None
,
cpu_shares
=
None
,
tmpfs
=
None
,
oom_score_adj
=
None
,
dns_opt
=
None
,
cpu_shares
=
None
,
cpuset_cpus
=
None
,
userns_mode
=
None
,
pids_limit
=
None
,
cpuset_cpus
=
None
,
userns_mode
=
None
,
pids_limit
=
None
,
isolation
=
None
,
auto_remove
=
False
):
isolation
=
None
,
auto_remove
=
False
,
storage_opt
=
None
):
if
mem_limit
is
not
None
:
if
mem_limit
is
not
None
:
self
[
'Memory'
]
=
parse_bytes
(
mem_limit
)
self
[
'Memory'
]
=
parse_bytes
(
mem_limit
)
...
@@ -412,6 +412,11 @@ class HostConfig(dict):
...
@@ -412,6 +412,11 @@ class HostConfig(dict):
raise
host_config_version_error
(
'auto_remove'
,
'1.25'
)
raise
host_config_version_error
(
'auto_remove'
,
'1.25'
)
self
[
'AutoRemove'
]
=
auto_remove
self
[
'AutoRemove'
]
=
auto_remove
if
storage_opt
is
not
None
:
if
version_lt
(
version
,
'1.24'
):
raise
host_config_version_error
(
'storage_opt'
,
'1.24'
)
self
[
'StorageOpt'
]
=
storage_opt
def
host_config_type_error
(
param
,
param_value
,
expected
):
def
host_config_type_error
(
param
,
param_value
,
expected
):
error_msg
=
'Invalid type for {0} param: expected {1} but found {2}'
error_msg
=
'Invalid type for {0} param: expected {1} but found {2}'
...
...
tests/integration/api_container_test.py
Dosyayı görüntüle @
161bfba9
...
@@ -422,6 +422,22 @@ class CreateContainerTest(BaseAPIIntegrationTest):
...
@@ -422,6 +422,22 @@ class CreateContainerTest(BaseAPIIntegrationTest):
config
=
self
.
client
.
inspect_container
(
container
)
config
=
self
.
client
.
inspect_container
(
container
)
assert
config
[
'Config'
][
'StopTimeout'
]
==
25
assert
config
[
'Config'
][
'StopTimeout'
]
==
25
@requires_api_version
(
'1.24'
)
def
test_create_with_storage_opt
(
self
):
if
self
.
client
.
info
()[
'Driver'
]
==
'aufs'
:
return
pytest
.
skip
(
'Not supported on AUFS'
)
host_config
=
self
.
client
.
create_host_config
(
storage_opt
=
{
'size'
:
'120G'
}
)
container
=
self
.
client
.
create_container
(
BUSYBOX
,
[
'echo'
,
'test'
],
host_config
=
host_config
)
self
.
tmp_containers
.
append
(
container
)
config
=
self
.
client
.
inspect_container
(
container
)
assert
config
[
'HostConfig'
][
'StorageOpt'
]
==
{
'size'
:
'120G'
}
class
VolumeBindTest
(
BaseAPIIntegrationTest
):
class
VolumeBindTest
(
BaseAPIIntegrationTest
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
tests/integration/base.py
Dosyayı görüntüle @
161bfba9
...
@@ -75,6 +75,10 @@ class BaseAPIIntegrationTest(BaseIntegrationTest):
...
@@ -75,6 +75,10 @@ class BaseAPIIntegrationTest(BaseIntegrationTest):
version
=
TEST_API_VERSION
,
timeout
=
60
,
**
kwargs_from_env
()
version
=
TEST_API_VERSION
,
timeout
=
60
,
**
kwargs_from_env
()
)
)
def
tearDown
(
self
):
super
(
BaseAPIIntegrationTest
,
self
)
.
tearDown
()
self
.
client
.
close
()
def
run_container
(
self
,
*
args
,
**
kwargs
):
def
run_container
(
self
,
*
args
,
**
kwargs
):
container
=
self
.
client
.
create_container
(
*
args
,
**
kwargs
)
container
=
self
.
client
.
create_container
(
*
args
,
**
kwargs
)
self
.
tmp_containers
.
append
(
container
)
self
.
tmp_containers
.
append
(
container
)
...
...
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