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
c6986746
Kaydet (Commit)
c6986746
authored
Eki 15, 2015
tarafından
Daniel Nephin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #808 from alasdairnicol/docs_examples
Docs examples
üst
51d2125c
0c2aaac3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
26 deletions
+27
-26
api.md
docs/api.md
+8
-8
boot2docker.md
docs/boot2docker.md
+5
-4
host-devices.md
docs/host-devices.md
+2
-2
hostconfig.md
docs/hostconfig.md
+2
-2
port-bindings.md
docs/port-bindings.md
+6
-6
volumes.md
docs/volumes.md
+4
-4
No files found.
docs/api.md
Dosyayı görüntüle @
c6986746
...
@@ -4,8 +4,8 @@ To instantiate a `Client` class that will allow you to communicate with a
...
@@ -4,8 +4,8 @@ To instantiate a `Client` class that will allow you to communicate with a
Docker daemon, simply do:
Docker daemon, simply do:
```
python
```
python
from
docker
import
Client
>>>
from
docker
import
Client
c
=
Client
(
base_url
=
'unix://var/run/docker.sock'
)
>>>
cli
=
Client
(
base_url
=
'unix://var/run/docker.sock'
)
```
```
**Params**
:
**Params**
:
...
@@ -250,9 +250,9 @@ PASSWORD=secret
...
@@ -250,9 +250,9 @@ PASSWORD=secret
The utility can be used as follows:
The utility can be used as follows:
```
python
```
python
>>
import
docker.utils
>>
>
import
docker.utils
>>
my_envs
=
docker
.
utils
.
parse_env_file
(
'/path/to/file'
)
>>
>
my_envs
=
docker
.
utils
.
parse_env_file
(
'/path/to/file'
)
>>
docker
.
utils
.
create_container_config
(
'1.18'
,
'_mongodb'
,
'foobar'
,
environment
=
my_envs
)
>>
>
docker
.
utils
.
create_container_config
(
'1.18'
,
'_mongodb'
,
'foobar'
,
environment
=
my_envs
)
```
```
You can now use this with 'environment' for
`create_container`
.
You can now use this with 'environment' for
`create_container`
.
...
@@ -392,9 +392,9 @@ a dict containing `stat` information on the specified `path`.
...
@@ -392,9 +392,9 @@ a dict containing `stat` information on the specified `path`.
```
python
```
python
>>>
import
docker
>>>
import
docker
>>>
c
=
docker
.
Client
()
>>>
c
li
=
docker
.
Client
()
>>>
ctnr
=
c
.
create_container
(
'busybox'
,
'true'
)
>>>
ctnr
=
c
li
.
create_container
(
'busybox'
,
'true'
)
>>>
strm
,
stat
=
c
.
get_archive
(
ctnr
,
'/bin/sh'
)
>>>
strm
,
stat
=
c
li
.
get_archive
(
ctnr
,
'/bin/sh'
)
>>>
print
(
stat
)
>>>
print
(
stat
)
{
u'linkTarget'
:
u''
,
u'mode'
:
493
,
u'mtime'
:
u'2015-09-16T12:34:23-07:00'
,
u'name'
:
u'sh'
,
u'size'
:
962860
}
{
u'linkTarget'
:
u''
,
u'mode'
:
493
,
u'mtime'
:
u'2015-09-16T12:34:23-07:00'
,
u'name'
:
u'sh'
,
u'size'
:
962860
}
```
```
...
...
docs/boot2docker.md
Dosyayı görüntüle @
c6986746
...
@@ -15,8 +15,8 @@ You can then instantiate `docker.Client` like this:
...
@@ -15,8 +15,8 @@ You can then instantiate `docker.Client` like this:
from
docker.client
import
Client
from
docker.client
import
Client
from
docker.utils
import
kwargs_from_env
from
docker.utils
import
kwargs_from_env
cli
ent
=
Client
(
**
kwargs_from_env
())
cli
=
Client
(
**
kwargs_from_env
())
print
cli
ent
.
version
()
print
cli
.
version
()
```
```
If you're encountering the following error:
If you're encountering the following error:
...
@@ -33,6 +33,6 @@ from docker.utils import kwargs_from_env
...
@@ -33,6 +33,6 @@ from docker.utils import kwargs_from_env
kwargs
=
kwargs_from_env
()
kwargs
=
kwargs_from_env
()
kwargs
[
'tls'
]
.
assert_hostname
=
False
kwargs
[
'tls'
]
.
assert_hostname
=
False
cli
ent
=
Client
(
**
kwargs
)
cli
=
Client
(
**
kwargs
)
print
cli
ent
.
version
()
print
cli
.
version
()
```
```
\ No newline at end of file
docs/host-devices.md
Dosyayı görüntüle @
c6986746
...
@@ -5,8 +5,8 @@ the devices parameter in the `host_config` param in `Client.create_container`
...
@@ -5,8 +5,8 @@ the devices parameter in the `host_config` param in `Client.create_container`
as shown below:
as shown below:
```
python
```
python
c
.
create_container
(
c
li
.
create_container
(
'busybox'
,
'true'
,
host_config
=
docker
.
utils
.
create_host_config
(
devices
=
[
'busybox'
,
'true'
,
host_config
=
cli
.
create_host_config
(
devices
=
[
'/dev/sda:/dev/xvda:rwm'
'/dev/sda:/dev/xvda:rwm'
])
])
)
)
...
...
docs/hostconfig.md
Dosyayı görüntüle @
c6986746
...
@@ -114,7 +114,7 @@ for example:
...
@@ -114,7 +114,7 @@ for example:
```
python
```
python
>>> from docker import Client
>>> from docker import Client
>>> c = Client()
>>> c
li
= Client()
>>> c.create_host_config(privileged=True, cap_drop=['MKNOD'], volumes_from=['nostalgic_newton'])
>>> c
li
.create_host_config(privileged=True, cap_drop=['MKNOD'], volumes_from=['nostalgic_newton'])
{'CapDrop':
[
'MKNOD'
]
, 'LxcConf': None, 'Privileged': True, 'VolumesFrom':
[
'nostalgic_newton'
]
, 'PublishAllPorts': False}
{'CapDrop':
[
'MKNOD'
]
, 'LxcConf': None, 'Privileged': True, 'VolumesFrom':
[
'nostalgic_newton'
]
, 'PublishAllPorts': False}
```
```
docs/port-bindings.md
Dosyayı görüntüle @
c6986746
...
@@ -4,9 +4,9 @@ open inside the container in the `Client().create_container()` method.
...
@@ -4,9 +4,9 @@ open inside the container in the `Client().create_container()` method.
Bindings are declared in the
`host_config`
parameter.
Bindings are declared in the
`host_config`
parameter.
```
python
```
python
container_id
=
c
.
create_container
(
container_id
=
c
li
.
create_container
(
'busybox'
,
'ls'
,
ports
=
[
1111
,
2222
],
'busybox'
,
'ls'
,
ports
=
[
1111
,
2222
],
host_config
=
docker
.
utils
.
create_host_config
(
port_bindings
=
{
host_config
=
cli
.
create_host_config
(
port_bindings
=
{
1111
:
4567
,
1111
:
4567
,
2222
:
None
2222
:
None
})
})
...
@@ -17,22 +17,22 @@ container_id = c.create_container(
...
@@ -17,22 +17,22 @@ container_id = c.create_container(
You can limit the host address on which the port will be exposed like such:
You can limit the host address on which the port will be exposed like such:
```
python
```
python
docker
.
utils
.
create_host_config
(
port_bindings
=
{
1111
:
(
'127.0.0.1'
,
4567
)})
cli
.
create_host_config
(
port_bindings
=
{
1111
:
(
'127.0.0.1'
,
4567
)})
```
```
Or without host port assignment:
Or without host port assignment:
```
python
```
python
docker
.
utils
.
create_host_config
(
port_bindings
=
{
1111
:
(
'127.0.0.1'
,)})
cli
.
create_host_config
(
port_bindings
=
{
1111
:
(
'127.0.0.1'
,)})
```
```
If you wish to use UDP instead of TCP (default), you need to declare ports
If you wish to use UDP instead of TCP (default), you need to declare ports
as such in both the config and host config:
as such in both the config and host config:
```
python
```
python
container_id
=
c
.
create_container
(
container_id
=
c
li
.
create_container
(
'busybox'
,
'ls'
,
ports
=
[(
1111
,
'udp'
),
2222
],
'busybox'
,
'ls'
,
ports
=
[(
1111
,
'udp'
),
2222
],
host_config
=
docker
.
utils
.
create_host_config
(
port_bindings
=
{
host_config
=
cli
.
create_host_config
(
port_bindings
=
{
'1111/udp'
:
4567
,
2222
:
None
'1111/udp'
:
4567
,
2222
:
None
})
})
)
)
...
...
docs/volumes.md
Dosyayı görüntüle @
c6986746
...
@@ -5,9 +5,9 @@ the `Client().create_container()` method, and declare mappings in the
...
@@ -5,9 +5,9 @@ the `Client().create_container()` method, and declare mappings in the
`host_config`
section.
`host_config`
section.
```
python
```
python
container_id
=
c
.
create_container
(
container_id
=
c
li
.
create_container
(
'busybox'
,
'ls'
,
volumes
=
[
'/mnt/vol1'
,
'/mnt/vol2'
],
'busybox'
,
'ls'
,
volumes
=
[
'/mnt/vol1'
,
'/mnt/vol2'
],
host_config
=
docker
.
utils
.
create_host_config
(
binds
=
{
host_config
=
cli
.
create_host_config
(
binds
=
{
'/home/user1/'
:
{
'/home/user1/'
:
{
'bind'
:
'/mnt/vol2'
,
'bind'
:
'/mnt/vol2'
,
'mode'
:
'rw'
,
'mode'
:
'rw'
,
...
@@ -24,9 +24,9 @@ You can alternatively specify binds as a list. This code is equivalent to the
...
@@ -24,9 +24,9 @@ You can alternatively specify binds as a list. This code is equivalent to the
example above:
example above:
```
python
```
python
container_id
=
c
.
create_container
(
container_id
=
c
li
.
create_container
(
'busybox'
,
'ls'
,
volumes
=
[
'/mnt/vol1'
,
'/mnt/vol2'
],
'busybox'
,
'ls'
,
volumes
=
[
'/mnt/vol1'
,
'/mnt/vol2'
],
host_config
=
docker
.
utils
.
create_host_config
(
binds
=
[
host_config
=
cli
.
create_host_config
(
binds
=
[
'/home/user1/:/mnt/vol2'
,
'/home/user1/:/mnt/vol2'
,
'/var/www:/mnt/vol1:ro'
,
'/var/www:/mnt/vol1:ro'
,
])
])
...
...
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