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
dec29e1c
Kaydet (Commit)
dec29e1c
authored
Tem 29, 2016
tarafından
Jari Takkala
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for sysctl when creating container
Closes #1144 Signed-off-by:
Jari Takkala
<
jtakkala@gmail.com
>
üst
f99dc45d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
1 deletion
+36
-1
utils.py
docker/utils/utils.py
+8
-1
hostconfig.md
docs/hostconfig.md
+1
-0
container_test.py
tests/unit/container_test.py
+27
-0
No files found.
docker/utils/utils.py
Dosyayı görüntüle @
dec29e1c
...
...
@@ -619,7 +619,7 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
blkio_weight_device
=
None
,
device_read_bps
=
None
,
device_write_bps
=
None
,
device_read_iops
=
None
,
device_write_iops
=
None
,
oom_kill_disable
=
False
,
shm_size
=
None
,
version
=
None
,
tmpfs
=
None
,
shm_size
=
None
,
sysctls
=
None
,
version
=
None
,
tmpfs
=
None
,
oom_score_adj
=
None
):
host_config
=
{}
...
...
@@ -725,6 +725,13 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
host_config
[
'SecurityOpt'
]
=
security_opt
if
sysctls
:
if
not
isinstance
(
sysctls
,
dict
):
raise
host_config_type_error
(
'sysctls'
,
sysctls
,
'dict'
)
host_config
[
'Sysctls'
]
=
{}
for
k
,
v
in
six
.
iteritems
(
sysctls
):
host_config
[
'Sysctls'
][
k
]
=
six
.
text_type
(
v
)
if
volumes_from
is
not
None
:
if
isinstance
(
volumes_from
,
six
.
string_types
):
volumes_from
=
volumes_from
.
split
(
','
)
...
...
docs/hostconfig.md
Dosyayı görüntüle @
dec29e1c
...
...
@@ -123,6 +123,7 @@ for example:
for more information.
*
tmpfs: Temporary filesystems to mouunt. See
[
Using tmpfs
](
tmpfs.md
)
for more
information.
*
sysctls (dict): Kernel parameters to set in the container.
**Returns**
(dict) HostConfig dictionary
...
...
tests/unit/container_test.py
Dosyayı görüntüle @
dec29e1c
...
...
@@ -1074,6 +1074,33 @@ class CreateContainerTest(DockerClientTest):
DEFAULT_TIMEOUT_SECONDS
)
@requires_api_version
(
'1.24'
)
def
test_create_container_with_sysctl
(
self
):
self
.
client
.
create_container
(
'busybox'
,
'true'
,
host_config
=
self
.
client
.
create_host_config
(
sysctls
=
{
'net.core.somaxconn'
:
1024
,
'net.ipv4.tcp_syncookies'
:
'0'
,
}
)
)
args
=
fake_request
.
call_args
self
.
assertEqual
(
args
[
0
][
1
],
url_prefix
+
'containers/create'
)
expected_payload
=
self
.
base_create_payload
()
expected_payload
[
'HostConfig'
]
=
self
.
client
.
create_host_config
()
expected_payload
[
'HostConfig'
][
'Sysctls'
]
=
{
'net.core.somaxconn'
:
'1024'
,
'net.ipv4.tcp_syncookies'
:
'0'
,
}
self
.
assertEqual
(
json
.
loads
(
args
[
1
][
'data'
]),
expected_payload
)
self
.
assertEqual
(
args
[
1
][
'headers'
],
{
'Content-Type'
:
'application/json'
}
)
self
.
assertEqual
(
args
[
1
][
'timeout'
],
DEFAULT_TIMEOUT_SECONDS
)
class
ContainerTest
(
DockerClientTest
):
def
test_list_containers
(
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