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
ab2f7a5e
Kaydet (Commit)
ab2f7a5e
authored
Ock 19, 2014
tarafından
Ben Firshman
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add cpu_shares option to create_container
üst
8e8b355a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
README.md
README.md
+1
-1
client.py
docker/client.py
+7
-4
test.py
tests/test.py
+22
-0
No files found.
README.md
Dosyayı görüntüle @
ab2f7a5e
...
...
@@ -56,7 +56,7 @@ c.create_container(image, command=None, hostname=None, user=None,
detach
=
False
,
stdin_open
=
False
,
tty
=
False
,
mem_limit
=
0
,
ports
=
None
,
environment
=
None
,
dns
=
None
,
volumes
=
None
,
volumes_from
=
None
,
network_disabled
=
False
,
name
=
None
,
entrypoint
=
None
)
entrypoint
=
None
,
cpu_shares
=
None
)
```
Creates a container that can then be
`start`
ed. Parameters are similar
...
...
docker/client.py
Dosyayı görüntüle @
ab2f7a5e
...
...
@@ -122,7 +122,8 @@ class Client(requests.Session):
detach
=
False
,
stdin_open
=
False
,
tty
=
False
,
mem_limit
=
0
,
ports
=
None
,
environment
=
None
,
dns
=
None
,
volumes
=
None
,
volumes_from
=
None
,
network_disabled
=
False
,
entrypoint
=
None
):
network_disabled
=
False
,
entrypoint
=
None
,
cpu_shares
=
None
):
if
isinstance
(
command
,
six
.
string_types
):
command
=
shlex
.
split
(
str
(
command
))
if
isinstance
(
environment
,
dict
):
...
...
@@ -176,7 +177,8 @@ class Client(requests.Session):
'Volumes'
:
volumes
,
'VolumesFrom'
:
volumes_from
,
'NetworkDisabled'
:
network_disabled
,
'Entrypoint'
:
entrypoint
'Entrypoint'
:
entrypoint
,
'CpuShares'
:
cpu_shares
}
def
_post_json
(
self
,
url
,
data
,
**
kwargs
):
...
...
@@ -407,12 +409,13 @@ class Client(requests.Session):
detach
=
False
,
stdin_open
=
False
,
tty
=
False
,
mem_limit
=
0
,
ports
=
None
,
environment
=
None
,
dns
=
None
,
volumes
=
None
,
volumes_from
=
None
,
network_disabled
=
False
,
name
=
None
,
entrypoint
=
None
):
network_disabled
=
False
,
name
=
None
,
entrypoint
=
None
,
cpu_shares
=
None
):
config
=
self
.
_container_config
(
image
,
command
,
hostname
,
user
,
detach
,
stdin_open
,
tty
,
mem_limit
,
ports
,
environment
,
dns
,
volumes
,
volumes_from
,
network_disabled
,
entrypoint
entrypoint
,
cpu_shares
)
return
self
.
create_container_from_config
(
config
,
name
)
...
...
tests/test.py
Dosyayı görüntüle @
ab2f7a5e
...
...
@@ -251,6 +251,28 @@ class DockerClientTest(unittest.TestCase):
self
.
assertEqual
(
args
[
1
][
'headers'
],
{
'Content-Type'
:
'application/json'
})
def
test_create_container_with_cpu_shares
(
self
):
try
:
self
.
client
.
create_container
(
'busybox'
,
'ls'
,
cpu_shares
=
5
)
except
Exception
as
e
:
self
.
fail
(
'Command should not raise exception: {0}'
.
format
(
e
))
args
=
fake_request
.
call_args
self
.
assertEqual
(
args
[
0
][
0
],
'unix://var/run/docker.sock/v1.6/containers/create'
)
self
.
assertEqual
(
json
.
loads
(
args
[
1
][
'data'
]),
json
.
loads
(
'''
{"Tty": false, "Image": "busybox",
"Cmd": ["ls"], "AttachStdin": false,
"Memory": 0,
"AttachStderr": true,
"AttachStdout": true, "OpenStdin": false,
"NetworkDisabled": false,
"CpuShares": 5}'''
))
self
.
assertEqual
(
args
[
1
][
'headers'
],
{
'Content-Type'
:
'application/json'
})
def
test_create_named_container
(
self
):
try
:
self
.
client
.
create_container
(
'busybox'
,
'true'
,
...
...
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