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
e1518bf2
Kaydet (Commit)
e1518bf2
authored
Kas 09, 2016
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Kas 09, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1263 from rmb938/labelshm
Add labels and shmsize arguments to the image build
üst
bd10874b
98e2e1fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
1 deletion
+59
-1
build.py
docker/api/build.py
+18
-1
api.md
docs/api.md
+3
-0
build_test.py
tests/integration/build_test.py
+38
-0
No files found.
docker/api/build.py
Dosyayı görüntüle @
e1518bf2
...
...
@@ -17,7 +17,8 @@ class BuildApiMixin(object):
nocache
=
False
,
rm
=
False
,
stream
=
False
,
timeout
=
None
,
custom_context
=
False
,
encoding
=
None
,
pull
=
False
,
forcerm
=
False
,
dockerfile
=
None
,
container_limits
=
None
,
decode
=
False
,
buildargs
=
None
,
gzip
=
False
):
decode
=
False
,
buildargs
=
None
,
gzip
=
False
,
shmsize
=
None
,
labels
=
None
):
remote
=
context
=
None
headers
=
{}
container_limits
=
container_limits
or
{}
...
...
@@ -88,6 +89,22 @@ class BuildApiMixin(object):
'buildargs was only introduced in API version 1.21'
)
if
shmsize
:
if
utils
.
version_gte
(
self
.
_version
,
'1.22'
):
params
.
update
({
'shmsize'
:
shmsize
})
else
:
raise
errors
.
InvalidVersion
(
'shmsize was only introduced in API version 1.22'
)
if
labels
:
if
utils
.
version_gte
(
self
.
_version
,
'1.23'
):
params
.
update
({
'labels'
:
json
.
dumps
(
labels
)})
else
:
raise
errors
.
InvalidVersion
(
'labels was only introduced in API version 1.23'
)
if
context
is
not
None
:
headers
=
{
'Content-Type'
:
'application/tar'
}
if
encoding
:
...
...
docs/api.md
Dosyayı görüntüle @
e1518bf2
...
...
@@ -76,6 +76,9 @@ correct value (e.g `gzip`).
-
cpusetcpus (str): CPUs in which to allow execution, e.g.,
`"0-3"`
,
`"0,1"`
*
decode (bool): If set to
`True`
, the returned stream will be decoded into
dicts on the fly. Default
`False`
.
*
shmsize (int): Size of /dev/shm in bytes. The size must be greater
than 0. If omitted the system uses 64MB.
*
labels (dict): A dictionary of labels to set on the image
**Returns**
(generator): A generator for the build output
...
...
tests/integration/build_test.py
Dosyayı görüntüle @
e1518bf2
...
...
@@ -118,6 +118,44 @@ class BuildTest(BaseIntegrationTest):
info
=
self
.
client
.
inspect_image
(
'buildargs'
)
self
.
assertEqual
(
info
[
'Config'
][
'User'
],
'OK'
)
@requires_api_version
(
'1.22'
)
def
test_build_shmsize
(
self
):
script
=
io
.
BytesIO
(
'
\n
'
.
join
([
'FROM scratch'
,
'CMD sh -c "echo
\'
Hello, World!
\'
"'
,
])
.
encode
(
'ascii'
))
tag
=
'shmsize'
shmsize
=
134217728
stream
=
self
.
client
.
build
(
fileobj
=
script
,
tag
=
tag
,
shmsize
=
shmsize
)
self
.
tmp_imgs
.
append
(
tag
)
for
chunk
in
stream
:
pass
# There is currently no way to get the shmsize
# that was used to build the image
@requires_api_version
(
'1.23'
)
def
test_build_labels
(
self
):
script
=
io
.
BytesIO
(
'
\n
'
.
join
([
'FROM scratch'
,
])
.
encode
(
'ascii'
))
labels
=
{
'test'
:
'OK'
}
stream
=
self
.
client
.
build
(
fileobj
=
script
,
tag
=
'labels'
,
labels
=
labels
)
self
.
tmp_imgs
.
append
(
'labels'
)
for
chunk
in
stream
:
pass
info
=
self
.
client
.
inspect_image
(
'labels'
)
self
.
assertEqual
(
info
[
'Config'
][
'Labels'
],
labels
)
def
test_build_stderr_data
(
self
):
control_chars
=
[
'
\x1b
[91m'
,
'
\x1b
[0m'
]
snippet
=
'Ancient Temple (Mystic Oriental Dream ~ Ancient Temple)'
...
...
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