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
49997d04
Kaydet (Commit)
49997d04
authored
Eyl 29, 2016
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for isolation param in host config
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
2b34e0b8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
utils.py
docker/utils/utils.py
+9
-1
hostconfig.md
docs/hostconfig.md
+1
-0
container_test.py
tests/integration/container_test.py
+11
-0
utils_test.py
tests/unit/utils_test.py
+12
-1
No files found.
docker/utils/utils.py
Dosyayı görüntüle @
49997d04
...
...
@@ -624,7 +624,8 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
device_write_iops
=
None
,
oom_kill_disable
=
False
,
shm_size
=
None
,
sysctls
=
None
,
version
=
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
):
host_config
=
{}
...
...
@@ -912,6 +913,13 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
raise
host_config_version_error
(
'pids_limit'
,
'1.23'
)
host_config
[
"PidsLimit"
]
=
pids_limit
if
isolation
:
if
not
isinstance
(
isolation
,
six
.
string_types
):
raise
host_config_type_error
(
'isolation'
,
isolation
,
'string'
)
if
version_lt
(
version
,
'1.24'
):
raise
host_config_version_error
(
'isolation'
,
'1.24'
)
host_config
[
'Isolation'
]
=
isolation
return
host_config
...
...
docs/hostconfig.md
Dosyayı görüntüle @
49997d04
...
...
@@ -130,6 +130,7 @@ for example:
*
userns_mode (str): Sets the user namespace mode for the container when user
namespace remapping option is enabled. Supported values are:
`host`
*
pids_limit (int): Tune a container’s pids limit. Set -1 for unlimited.
*
isolation (str): Isolation technology to use. Default:
`None`
.
**Returns**
(dict) HostConfig dictionary
...
...
tests/integration/container_test.py
Dosyayı görüntüle @
49997d04
...
...
@@ -397,6 +397,17 @@ class CreateContainerTest(helpers.BaseTestCase):
config
=
self
.
client
.
inspect_container
(
container
)
assert
config
[
'HostConfig'
][
'Tmpfs'
]
==
tmpfs
@requires_api_version
(
'1.24'
)
def
test_create_with_isolation
(
self
):
container
=
self
.
client
.
create_container
(
BUSYBOX
,
[
'echo'
],
host_config
=
self
.
client
.
create_host_config
(
isolation
=
'default'
)
)
self
.
tmp_containers
.
append
(
container
[
'Id'
])
config
=
self
.
client
.
inspect_container
(
container
)
assert
config
[
'HostConfig'
][
'Isolation'
]
==
'default'
class
VolumeBindTest
(
helpers
.
BaseTestCase
):
def
setUp
(
self
):
...
...
tests/unit/utils_test.py
Dosyayı görüntüle @
49997d04
...
...
@@ -192,7 +192,18 @@ class HostConfigTest(base.BaseTestCase):
with
pytest
.
raises
(
InvalidVersion
):
create_host_config
(
version
=
'1.22'
,
pids_limit
=
1024
)
with
pytest
.
raises
(
TypeError
):
create_host_config
(
version
=
'1.22'
,
pids_limit
=
'1024'
)
create_host_config
(
version
=
'1.23'
,
pids_limit
=
'1024'
)
def
test_create_host_config_with_isolation
(
self
):
config
=
create_host_config
(
version
=
'1.24'
,
isolation
=
'hyperv'
)
self
.
assertEqual
(
config
.
get
(
'Isolation'
),
'hyperv'
)
with
pytest
.
raises
(
InvalidVersion
):
create_host_config
(
version
=
'1.23'
,
isolation
=
'hyperv'
)
with
pytest
.
raises
(
TypeError
):
create_host_config
(
version
=
'1.24'
,
isolation
=
{
'isolation'
:
'hyperv'
}
)
class
UlimitTest
(
base
.
BaseTestCase
):
...
...
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