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
ae8c7163
Kaydet (Commit)
ae8c7163
authored
Şub 21, 2017
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Şub 21, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1466 from nkrabshuis/master
Add ability to set 'Hostname' on a Service.
üst
b791aa10
9ec31ffa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
services.py
docker/models/services.py
+2
-0
services.py
docker/types/services.py
+6
-3
models_services_test.py
tests/unit/models_services_test.py
+3
-2
No files found.
docker/models/services.py
Dosyayı görüntüle @
ae8c7163
...
@@ -96,6 +96,7 @@ class ServiceCollection(Collection):
...
@@ -96,6 +96,7 @@ class ServiceCollection(Collection):
access and load balance a service. Default: ``None``.
access and load balance a service. Default: ``None``.
env (list of str): Environment variables, in the form
env (list of str): Environment variables, in the form
``KEY=val``.
``KEY=val``.
hostname (string): Hostname to set on the container.
labels (dict): Labels to apply to the service.
labels (dict): Labels to apply to the service.
log_driver (str): Log driver to use for containers.
log_driver (str): Log driver to use for containers.
log_driver_options (dict): Log driver options.
log_driver_options (dict): Log driver options.
...
@@ -176,6 +177,7 @@ CONTAINER_SPEC_KWARGS = [
...
@@ -176,6 +177,7 @@ CONTAINER_SPEC_KWARGS = [
'command'
,
'command'
,
'args'
,
'args'
,
'env'
,
'env'
,
'hostname'
,
'workdir'
,
'workdir'
,
'user'
,
'user'
,
'labels'
,
'labels'
,
...
...
docker/types/services.py
Dosyayı görüntüle @
ae8c7163
...
@@ -70,6 +70,7 @@ class ContainerSpec(dict):
...
@@ -70,6 +70,7 @@ class ContainerSpec(dict):
image (string): The image name to use for the container.
image (string): The image name to use for the container.
command (string or list): The command to be run in the image.
command (string or list): The command to be run in the image.
args (:py:class:`list`): Arguments to the command.
args (:py:class:`list`): Arguments to the command.
hostname (string): The hostname to set on the container.
env (dict): Environment variables.
env (dict): Environment variables.
dir (string): The working directory for commands to run in.
dir (string): The working directory for commands to run in.
user (string): The user inside the container.
user (string): The user inside the container.
...
@@ -82,9 +83,9 @@ class ContainerSpec(dict):
...
@@ -82,9 +83,9 @@ class ContainerSpec(dict):
secrets (list of py:class:`SecretReference`): List of secrets to be
secrets (list of py:class:`SecretReference`): List of secrets to be
made available inside the containers.
made available inside the containers.
"""
"""
def
__init__
(
self
,
image
,
command
=
None
,
args
=
None
,
env
=
None
,
workdir
=
None
,
def
__init__
(
self
,
image
,
command
=
None
,
args
=
None
,
hostname
=
None
,
env
=
None
,
user
=
None
,
labels
=
None
,
mounts
=
None
,
stop_grace_period
=
None
,
workdir
=
None
,
user
=
None
,
labels
=
None
,
mounts
=
None
,
secrets
=
None
):
s
top_grace_period
=
None
,
s
ecrets
=
None
):
self
[
'Image'
]
=
image
self
[
'Image'
]
=
image
if
isinstance
(
command
,
six
.
string_types
):
if
isinstance
(
command
,
six
.
string_types
):
...
@@ -92,6 +93,8 @@ class ContainerSpec(dict):
...
@@ -92,6 +93,8 @@ class ContainerSpec(dict):
self
[
'Command'
]
=
command
self
[
'Command'
]
=
command
self
[
'Args'
]
=
args
self
[
'Args'
]
=
args
if
hostname
is
not
None
:
self
[
'Hostname'
]
=
hostname
if
env
is
not
None
:
if
env
is
not
None
:
if
isinstance
(
env
,
dict
):
if
isinstance
(
env
,
dict
):
self
[
'Env'
]
=
format_environment
(
env
)
self
[
'Env'
]
=
format_environment
(
env
)
...
...
tests/unit/models_services_test.py
Dosyayı görüntüle @
ae8c7163
...
@@ -9,6 +9,7 @@ class CreateServiceKwargsTest(unittest.TestCase):
...
@@ -9,6 +9,7 @@ class CreateServiceKwargsTest(unittest.TestCase):
'command'
:
'true'
,
'command'
:
'true'
,
'name'
:
'somename'
,
'name'
:
'somename'
,
'labels'
:
{
'key'
:
'value'
},
'labels'
:
{
'key'
:
'value'
},
'hostname'
:
'test_host'
,
'mode'
:
'global'
,
'mode'
:
'global'
,
'update_config'
:
{
'update'
:
'config'
},
'update_config'
:
{
'update'
:
'config'
},
'networks'
:
[
'somenet'
],
'networks'
:
[
'somenet'
],
...
@@ -47,6 +48,6 @@ class CreateServiceKwargsTest(unittest.TestCase):
...
@@ -47,6 +48,6 @@ class CreateServiceKwargsTest(unittest.TestCase):
'Options'
:
{
'foo'
:
'bar'
}
'Options'
:
{
'foo'
:
'bar'
}
}
}
assert
set
(
task_template
[
'ContainerSpec'
]
.
keys
())
==
set
([
assert
set
(
task_template
[
'ContainerSpec'
]
.
keys
())
==
set
([
'Image'
,
'Command'
,
'Args'
,
'
Env'
,
'Dir'
,
'User'
,
'Labels
'
,
'Image'
,
'Command'
,
'Args'
,
'
Hostname'
,
'Env'
,
'Dir'
,
'User
'
,
'Mounts'
,
'StopGracePeriod'
'
Labels'
,
'
Mounts'
,
'StopGracePeriod'
])
])
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