blob: d8be9b68c60aea068e592e1426eacee4a7ac95a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# Using tmpfs
When creating a container, you can specify paths to be mounted with tmpfs using
the `tmpfs` argument to `create_host_config`, similarly to the `--tmpfs`
argument to `docker run`.
This capability is supported in Docker Engine 1.10 and up.
`tmpfs` can be either a list or a dictionary. If it's a list, each item is a
string specifying the path and (optionally) any configuration for the mount:
```python
client.create_container(
'busybox', 'ls',
host_config=client.create_host_config(tmpfs=[
'/mnt/vol2',
'/mnt/vol1:size=3G,uid=1000'
])
)
```
Alternatively, if it's a dictionary, each key is a path and each value contains
the mount options:
```python
client.create_container(
'busybox', 'ls',
host_config=client.create_host_config(tmpfs={
'/mnt/vol2': '',
'/mnt/vol1': 'size=3G,uid=1000'
})
)
```
|