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
c9f9157e
Kaydet (Commit)
c9f9157e
authored
Ara 16, 2014
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added create_host_config helper in docker.utils
üst
7bc6b228
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
1 deletion
+68
-1
__init__.py
docker/utils/__init__.py
+1
-1
utils.py
docker/utils/utils.py
+67
-0
No files found.
docker/utils/__init__.py
Dosyayı görüntüle @
c9f9157e
from
.utils
import
(
compare_version
,
convert_port_bindings
,
convert_volume_binds
,
mkbuildcontext
,
ping
,
tar
,
parse_repository_tag
,
parse_host
,
kwargs_from_env
,
convert_filters
kwargs_from_env
,
convert_filters
,
create_host_config
)
# flake8: noqa
docker/utils/utils.py
Dosyayı görüntüle @
c9f9157e
...
...
@@ -294,3 +294,70 @@ def convert_filters(filters):
v
=
[
v
,
]
result
[
k
]
=
v
return
json
.
dumps
(
result
)
def
create_host_config
(
binds
=
None
,
port_bindings
=
None
,
lxc_conf
=
None
,
publish_all_ports
=
False
,
links
=
None
,
privileged
=
False
,
dns
=
None
,
dns_search
=
None
,
volumes_from
=
None
,
network_mode
=
None
,
restart_policy
=
None
,
cap_add
=
None
,
cap_drop
=
None
,
devices
=
None
):
host_config
=
{
'Privileged'
:
privileged
,
'PublishAllPorts'
:
publish_all_ports
,
}
if
dns_search
:
host_config
[
'DnsSearch'
]
=
dns_search
if
network_mode
:
host_config
[
'NetworkMode'
]
=
network_mode
if
restart_policy
:
host_config
[
'RestartPolicy'
]
=
restart_policy
if
cap_add
:
host_config
[
'CapAdd'
]
=
cap_add
if
cap_drop
:
host_config
[
'CapDrop'
]
=
cap_drop
if
devices
:
host_config
[
'Devices'
]
=
parse_devices
(
devices
)
if
dns
is
not
None
:
host_config
[
'Dns'
]
=
dns
if
volumes_from
is
not
None
:
if
isinstance
(
volumes_from
,
six
.
string_types
):
volumes_from
=
volumes_from
.
split
(
','
)
host_config
[
'VolumesFrom'
]
=
volumes_from
if
binds
:
host_config
[
'Binds'
]
=
convert_volume_binds
(
binds
)
if
port_bindings
:
host_config
[
'PortBindings'
]
=
convert_port_bindings
(
port_bindings
)
host_config
[
'PublishAllPorts'
]
=
publish_all_ports
if
links
:
if
isinstance
(
links
,
dict
):
links
=
six
.
iteritems
(
links
)
formatted_links
=
[
'{0}:{1}'
.
format
(
k
,
v
)
for
k
,
v
in
sorted
(
links
)
]
host_config
[
'Links'
]
=
formatted_links
if
isinstance
(
lxc_conf
,
dict
):
formatted
=
[]
for
k
,
v
in
six
.
iteritems
(
lxc_conf
):
formatted
.
append
({
'Key'
:
k
,
'Value'
:
str
(
v
)})
lxc_conf
=
formatted
host_config
[
'LxcConf'
]
=
lxc_conf
return
host_config
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