Bound volumes must be repeated
See original GitHub issueFrom the less verbose example of mounting volumes,
container_id = c.create_container(
'busybox', 'ls', volumes=['/mnt/vol1', '/mnt/vol2'],
host_config=docker.utils.create_host_config(binds=[
'/home/user1/:/mnt/vol2',
'/var/www:/mnt/vol1:ro',
])
)
we can see that '/mnt/vol1'
and '/mnt/vol2'
must be repeated. A preferred API would simply be
container_id = c.create_container(
'busybox', 'ls',
volumes=['/var/www:/mnt/vol1:ro', '/home/user1/:/mnt/vol2']
)
In this API, volumes
- is actually a useful parameter when one needs to explicitly bind, without the verbosity of
host_config
andbinds
; - mirrors precisely the the API to
docker run
for mounting volumes, so that the user can re-apply the paradigm she has already learned; and - removes the need for redundantly specifying the same volume.
Additionally, volumes
could support the more explicit dictionary argument, similar to binds
:
container_id = c.create_container(
'busybox', 'ls',
volumes={
'/home/user1/': {
'bind': '/mnt/vol2',
'mode': 'rw',
},
'/var/www': {
'bind': '/mnt/vol1',
'mode': 'ro',
}
}
)
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Guidelines for Shelving Bound Volumes
These guidelines should be followed when shelving bound volumes. The needs of bound records are the same, despite differences in shelving equipment.
Read more >What is the difference between bound volumes and ... - Ask Us!
Bound volumes : Most periodicals have several issues to a volume (a volume usually spans one year's worth of publications of that periodical)....
Read more >Bound volumes and scrapbooks - Proceed
Volumes too thick to be housed in a folder, should be numbered as volumes (e.g., 1.1v). If the volume can be housed in...
Read more >Amazon EBS volumes - Amazon Elastic Compute Cloud
When you create an EBS volume, it is automatically replicated within its Availability Zone to prevent data loss due to failure of any...
Read more >[FEATURE] Allow volume expansion while in bound state
A workload must be shutdown before the Expand Volume option isn't grayed-out. Describe the solution you'd like. Allow xfs or ext4 volumes to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, sorry. It’s not actually released yet with documentation, but in 2.0 you’ll be able to do things along the lines of:
client.containers.run("busybox", volumes=['/var/www:/mnt/vol1:ro', '/home/user1/:/mnt/vol2'])
. Dittocreate()
.@bfirsh Great! Thanks for following up!