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
1aaa76dc
Unverified
Kaydet (Commit)
1aaa76dc
authored
Nis 14, 2019
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Nis 14, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #2297 from hannseman/service-init
Add support for setting init on services
üst
5e8b1c0e
0d5aacc4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
1 deletion
+27
-1
service.py
docker/api/service.py
+4
-0
services.py
docker/models/services.py
+3
-0
services.py
docker/types/services.py
+6
-1
api_service_test.py
tests/integration/api_service_test.py
+14
-0
No files found.
docker/api/service.py
Dosyayı görüntüle @
1aaa76dc
...
...
@@ -88,6 +88,10 @@ def _check_api_features(version, task_template, update_config, endpoint_spec,
if
container_spec
.
get
(
'Isolation'
)
is
not
None
:
raise_version_error
(
'ContainerSpec.isolation'
,
'1.35'
)
if
utils
.
version_lt
(
version
,
'1.38'
):
if
container_spec
.
get
(
'Init'
)
is
not
None
:
raise_version_error
(
'ContainerSpec.init'
,
'1.38'
)
if
task_template
.
get
(
'Resources'
):
if
utils
.
version_lt
(
version
,
'1.32'
):
if
task_template
[
'Resources'
]
.
get
(
'GenericResources'
):
...
...
docker/models/services.py
Dosyayı görüntüle @
1aaa76dc
...
...
@@ -165,6 +165,8 @@ class ServiceCollection(Collection):
env (list of str): Environment variables, in the form
``KEY=val``.
hostname (string): Hostname to set on the container.
init (boolean): Run an init inside the container that forwards
signals and reaps processes
isolation (string): Isolation technology used by the service's
containers. Only used for Windows containers.
labels (dict): Labels to apply to the service.
...
...
@@ -280,6 +282,7 @@ CONTAINER_SPEC_KWARGS = [
'hostname'
,
'hosts'
,
'image'
,
'init'
,
'isolation'
,
'labels'
,
'mounts'
,
...
...
docker/types/services.py
Dosyayı görüntüle @
1aaa76dc
...
...
@@ -110,13 +110,15 @@ class ContainerSpec(dict):
privileges (Privileges): Security options for the service's containers.
isolation (string): Isolation technology used by the service's
containers. Only used for Windows containers.
init (boolean): Run an init inside the container that forwards signals
and reaps processes.
"""
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
,
tty
=
None
,
groups
=
None
,
open_stdin
=
None
,
read_only
=
None
,
stop_signal
=
None
,
healthcheck
=
None
,
hosts
=
None
,
dns_config
=
None
,
configs
=
None
,
privileges
=
None
,
isolation
=
None
):
privileges
=
None
,
isolation
=
None
,
init
=
None
):
self
[
'Image'
]
=
image
if
isinstance
(
command
,
six
.
string_types
):
...
...
@@ -183,6 +185,9 @@ class ContainerSpec(dict):
if
isolation
is
not
None
:
self
[
'Isolation'
]
=
isolation
if
init
is
not
None
:
self
[
'Init'
]
=
init
class
Mount
(
dict
):
"""
...
...
tests/integration/api_service_test.py
Dosyayı görüntüle @
1aaa76dc
...
...
@@ -850,6 +850,20 @@ class ServiceTest(BaseAPIIntegrationTest):
)
assert
privileges
[
'SELinuxContext'
][
'Disable'
]
is
True
@requires_api_version
(
'1.38'
)
def
test_create_service_with_init
(
self
):
container_spec
=
docker
.
types
.
ContainerSpec
(
'busybox'
,
[
'sleep'
,
'999'
],
init
=
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
'Init'
in
svc_info
[
'Spec'
][
'TaskTemplate'
][
'ContainerSpec'
]
assert
(
svc_info
[
'Spec'
][
'TaskTemplate'
][
'ContainerSpec'
][
'Init'
]
is
True
)
@requires_api_version
(
'1.25'
)
def
test_update_service_with_defaults_name
(
self
):
container_spec
=
docker
.
types
.
ContainerSpec
(
...
...
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