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
e1eefce7
Kaydet (Commit)
e1eefce7
authored
Kas 18, 2015
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge branch 'schu-oom-kill-disable-pr'
üst
9ed72195
64eac0b7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
12 deletions
+27
-12
utils.py
docker/utils/utils.py
+17
-10
hostconfig.md
docs/hostconfig.md
+1
-0
container_test.py
tests/integration/container_test.py
+1
-1
utils_test.py
tests/unit/utils_test.py
+8
-1
No files found.
docker/utils/utils.py
Dosyayı görüntüle @
e1eefce7
...
...
@@ -469,16 +469,16 @@ def parse_bytes(s):
return
s
def
create_host_config
(
binds
=
None
,
port_bindings
=
None
,
lxc_conf
=
None
,
publish_all_ports
=
False
,
links
=
None
,
privileged
=
False
,
dns
=
None
,
dns_search
=
None
,
volumes_from
=
None
,
network_mode
=
None
,
restart_policy
=
None
,
cap_add
=
None
,
cap_drop
=
None
,
devices
=
None
,
extra_hosts
=
None
,
read_only
=
None
,
pid_mode
=
None
,
ipc_mode
=
None
,
security_opt
=
None
,
ulimits
=
None
,
log_config
=
None
,
mem_limit
=
None
,
memswap_limit
=
None
,
mem_swappiness
=
None
,
cgroup_parent
=
None
,
group_add
=
None
,
cpu_quota
=
None
,
cpu_period
=
None
,
version
=
None
):
def
create_host_config
(
binds
=
None
,
port_bindings
=
None
,
lxc_conf
=
None
,
publish_all_ports
=
False
,
links
=
None
,
privileged
=
False
,
dns
=
None
,
dns_search
=
None
,
volumes_from
=
None
,
network_mode
=
None
,
restart_policy
=
None
,
cap_add
=
None
,
cap_drop
=
None
,
devices
=
None
,
extra_hosts
=
None
,
read_only
=
None
,
pid_mode
=
None
,
ipc_mode
=
None
,
security_opt
=
None
,
ulimits
=
None
,
log_config
=
None
,
mem_limit
=
None
,
memswap_limit
=
None
,
mem_swappiness
=
None
,
cgroup_parent
=
None
,
group_add
=
None
,
cpu_quota
=
None
,
cpu_period
=
None
,
oom_kill_disable
=
False
,
version
=
None
):
host_config
=
{}
...
...
@@ -525,6 +525,13 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
if
privileged
:
host_config
[
'Privileged'
]
=
privileged
if
oom_kill_disable
:
if
version_lt
(
version
,
'1.19'
):
raise
errors
.
InvalidVersion
(
'oom_kill_disable param not supported for API version < 1.19'
)
host_config
[
'OomKillDisable'
]
=
oom_kill_disable
if
publish_all_ports
:
host_config
[
'PublishAllPorts'
]
=
publish_all_ports
...
...
docs/hostconfig.md
Dosyayı görüntüle @
e1eefce7
...
...
@@ -72,6 +72,7 @@ for example:
*
port_bindings (dict): Port bindings. See
[
Port bindings
](
port-bindings.md
)
for more information.
*
lxc_conf (dict): LXC config
*
oom_kill_disable (bool): Whether to disable OOM killer
*
publish_all_ports (bool): Whether to publish all ports to the host
*
links (dict or list of tuples): either as a dictionary mapping name to alias
or as a list of
`(name, alias)`
tuples
...
...
tests/integration/container_test.py
Dosyayı görüntüle @
e1eefce7
...
...
@@ -1054,7 +1054,7 @@ class GetContainerStatsTest(api_test.BaseTestCase):
self
.
client
.
kill
(
container
)
self
.
assertEqual
(
type
(
response
),
dict
)
for
key
in
[
'read'
,
'network'
,
'precpu_stats'
,
'cpu_stats'
,
for
key
in
[
'read'
,
'network
s
'
,
'precpu_stats'
,
'cpu_stats'
,
'memory_stats'
,
'blkio_stats'
]:
self
.
assertIn
(
key
,
response
)
...
...
tests/unit/utils_test.py
Dosyayı görüntüle @
e1eefce7
...
...
@@ -13,7 +13,7 @@ import six
from
docker.client
import
Client
from
docker.constants
import
DEFAULT_DOCKER_API_VERSION
from
docker.errors
import
DockerException
from
docker.errors
import
DockerException
,
InvalidVersion
from
docker.utils
import
(
parse_repository_tag
,
parse_host
,
convert_filters
,
kwargs_from_env
,
create_host_config
,
Ulimit
,
LogConfig
,
parse_bytes
,
parse_env_file
,
...
...
@@ -62,6 +62,13 @@ class HostConfigTest(base.BaseTestCase):
config
=
create_host_config
(
version
=
'1.20'
,
cpu_period
=
1999
)
self
.
assertEqual
(
config
.
get
(
'CpuPeriod'
),
1999
)
def
test_create_host_config_with_oom_kill_disable
(
self
):
config
=
create_host_config
(
version
=
'1.20'
,
oom_kill_disable
=
True
)
self
.
assertEqual
(
config
.
get
(
'OomKillDisable'
),
True
)
self
.
assertRaises
(
InvalidVersion
,
lambda
:
create_host_config
(
version
=
'1.18.3'
,
oom_kill_disable
=
True
))
class
UlimitTest
(
base
.
BaseTestCase
):
def
test_create_host_config_dict_ulimit
(
self
):
...
...
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