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
fc4bfde0
Kaydet (Commit)
fc4bfde0
authored
Haz 08, 2016
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Unify endpoint config creation when using connect_container_to_network
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
b6fa9862
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
22 deletions
+10
-22
network.py
docker/api/network.py
+5
-19
networks.md
docs/networks.md
+5
-3
No files found.
docker/api/network.py
Dosyayı görüntüle @
fc4bfde0
import
json
from
..errors
import
InvalidVersion
from
..utils
import
check_resource
,
minimum_version
,
normalize_links
from
..utils
import
check_resource
,
minimum_version
from
..utils
import
version_lt
...
...
@@ -63,26 +63,12 @@ class NetworkApiMixin(object):
aliases
=
None
,
links
=
None
):
data
=
{
"Container"
:
container
,
"EndpointConfig"
:
{
"Aliases"
:
aliase
s
,
"Links"
:
normalize_links
(
links
)
if
links
else
None
,
}
,
"EndpointConfig"
:
self
.
create_endpoint_config
(
aliases
=
aliases
,
links
=
links
,
ipv4_address
=
ipv4_addres
s
,
ipv6_address
=
ipv6_address
)
,
}
# IPv4 or IPv6 or neither:
if
ipv4_address
or
ipv6_address
:
if
version_lt
(
self
.
_version
,
'1.22'
):
raise
InvalidVersion
(
'IP address assignment is not '
'supported in API version < 1.22'
)
data
[
'EndpointConfig'
][
'IPAMConfig'
]
=
dict
()
if
ipv4_address
:
data
[
'EndpointConfig'
][
'IPAMConfig'
][
'IPv4Address'
]
=
\
ipv4_address
if
ipv6_address
:
data
[
'EndpointConfig'
][
'IPAMConfig'
][
'IPv6Address'
]
=
\
ipv6_address
url
=
self
.
_url
(
"/networks/{0}/connect"
,
net_id
)
res
=
self
.
_post_json
(
url
,
data
=
data
)
self
.
_raise_for_status
(
res
)
...
...
docs/networks.md
Dosyayı görüntüle @
fc4bfde0
...
...
@@ -17,11 +17,13 @@ For example, setting the subnet to `192.168.52.0/24` and gateway address
to
`192.168.52.254`
```
python
ipam_config
=
docker
.
utils
.
create_ipam_config
(
ipam_pool
=
docker
.
utils
.
create_ipam_pool
(
subnet
=
'192.168.52.0/24'
,
gateway
=
'192.168.52.254'
)
ipam_config
=
docker
.
utils
.
create_ipam_config
(
pool_configs
=
[
ipam_pool
]
)
docker_client
.
create_network
(
"network1"
,
driver
=
"bridge"
,
ipam
=
ipam_config
)
```
...
...
@@ -160,7 +162,7 @@ in `docker.utils.create_ipam_config`.
```
python
ipam_pool
=
docker
.
utils
.
create_ipam_pool
(
subnet
=
'124.42.0.0/16'
,
iprange
=
'124.42.0.0/
8
'
,
iprange
=
'124.42.0.0/
24
'
,
gateway
=
'124.42.0.254'
,
aux_addresses
=
{
'reserved1'
:
'124.42.1.1'
...
...
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