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
15030cb6
Kaydet (Commit)
15030cb6
authored
Haz 22, 2017
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Haz 22, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1661 from shin-/1622-service-tty
Add support for ContainerSpec.TTY
üst
be8c1448
06d2553b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
1 deletion
+29
-1
service.py
docker/api/service.py
+5
-0
services.py
docker/models/services.py
+2
-0
services.py
docker/types/services.py
+5
-1
api_service_test.py
tests/integration/api_service_test.py
+17
-0
No files found.
docker/api/service.py
Dosyayı görüntüle @
15030cb6
...
...
@@ -38,6 +38,11 @@ def _check_api_features(version, task_template, update_config):
'Placement.preferences is not supported in'
' API version < 1.27'
)
if
task_template
.
container_spec
.
get
(
'TTY'
):
if
utils
.
version_lt
(
version
,
'1.25'
):
raise
errors
.
InvalidVersion
(
'ContainerSpec.TTY is not supported in API version < 1.25'
)
class
ServiceApiMixin
(
object
):
...
...
docker/models/services.py
Dosyayı görüntüle @
15030cb6
...
...
@@ -146,6 +146,7 @@ class ServiceCollection(Collection):
of the service. Default: ``None``
user (str): User to run commands as.
workdir (str): Working directory for commands to run.
tty (boolean): Whether a pseudo-TTY should be allocated.
Returns:
(:py:class:`Service`) The created service.
...
...
@@ -212,6 +213,7 @@ CONTAINER_SPEC_KWARGS = [
'mounts'
,
'stop_grace_period'
,
'secrets'
,
'tty'
]
# kwargs to copy straight over to TaskTemplate
...
...
docker/types/services.py
Dosyayı görüntüle @
15030cb6
...
...
@@ -84,10 +84,11 @@ class ContainerSpec(dict):
terminate before forcefully killing it.
secrets (list of py:class:`SecretReference`): List of secrets to be
made available inside the containers.
tty (boolean): Whether a pseudo-TTY should be allocated.
"""
def
__init__
(
self
,
image
,
command
=
None
,
args
=
None
,
hostname
=
None
,
env
=
None
,
workdir
=
None
,
user
=
None
,
labels
=
None
,
mounts
=
None
,
stop_grace_period
=
None
,
secrets
=
None
):
stop_grace_period
=
None
,
secrets
=
None
,
tty
=
None
):
self
[
'Image'
]
=
image
if
isinstance
(
command
,
six
.
string_types
):
...
...
@@ -125,6 +126,9 @@ class ContainerSpec(dict):
raise
TypeError
(
'secrets must be a list'
)
self
[
'Secrets'
]
=
secrets
if
tty
is
not
None
:
self
[
'TTY'
]
=
tty
class
Mount
(
dict
):
"""
...
...
tests/integration/api_service_test.py
Dosyayı görüntüle @
15030cb6
...
...
@@ -359,6 +359,23 @@ class ServiceTest(BaseAPIIntegrationTest):
assert
'Env'
in
con_spec
assert
con_spec
[
'Env'
]
==
[
'DOCKER_PY_TEST=1'
]
@requires_api_version
(
'1.25'
)
def
test_create_service_with_tty
(
self
):
container_spec
=
docker
.
types
.
ContainerSpec
(
BUSYBOX
,
[
'true'
],
tty
=
True
)
task_tmpl
=
docker
.
types
.
TaskTemplate
(
container_spec
,
)
name
=
self
.
get_service_name
()
svc_id
=
self
.
client
.
create_service
(
task_tmpl
,
name
=
name
)
svc_info
=
self
.
client
.
inspect_service
(
svc_id
)
assert
'TaskTemplate'
in
svc_info
[
'Spec'
]
assert
'ContainerSpec'
in
svc_info
[
'Spec'
][
'TaskTemplate'
]
con_spec
=
svc_info
[
'Spec'
][
'TaskTemplate'
][
'ContainerSpec'
]
assert
'TTY'
in
con_spec
assert
con_spec
[
'TTY'
]
is
True
def
test_create_service_global_mode
(
self
):
container_spec
=
docker
.
types
.
ContainerSpec
(
BUSYBOX
,
[
'echo'
,
'hello'
]
...
...
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