question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bound volumes must be repeated

See original GitHub issue

From 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

  1. is actually a useful parameter when one needs to explicitly bind, without the verbosity of host_config and binds;
  2. 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
  3. 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:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bfirshcommented, Nov 29, 2016

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']). Ditto create().

0reactions
gotgenescommented, Nov 29, 2016

@bfirsh Great! Thanks for following up!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found