Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.7k
tmpfs support#994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
tmpfs support #994
Changes from all commits
9e9407072446b488ef5f307455a6a0545094ffa1be7417bc2e576417File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,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' | ||
| }) | ||
| ) | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -382,6 +382,22 @@ def test_create_with_environment_variable_no_value(self): | ||
| sorted(['Foo', 'Other=one', 'Blank=']) | ||
| ) | ||
| @requires_api_version('1.22') | ||
| def test_create_with_tmpfs(self): | ||
| tmpfs = { | ||
| '/tmp1': 'size=3M' | ||
| } | ||
| container = self.client.create_container( | ||
| BUSYBOX, | ||
| ['echo'], | ||
| host_config=self.client.create_host_config( | ||
| tmpfs=tmpfs)) | ||
| self.tmp_containers.append(container['Id']) | ||
| config = self.client.inspect_container(container) | ||
| assert config['HostConfig']['Tmpfs'] == tmpfs | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is failing with a KeyError for some reason, I'm not sure why, it seems to be correct to me. | ||
| class VolumeBindTest(helpers.BaseTestCase): | ||
| def setUp(self): | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file needs to be indexed in
mkdocs.yml