docker-py cannot bind local files into a container?
See original GitHub issuehi,all! I ofen bind host files into containers by using “-v /path/to/host/file:/container/file:ro”, when I using command line client. But now, I need to use docker-py to manage my containers. And I also need to do the same work:bind some host files into containers. And my code is like this (for example)
......
"volumes":["/etc/localtime"],
......
"binds":{
"/etc/localtime":{
"bind":"/etc/localtime",
"ro":true
}
},
unfortunately, problem emerged: APIError: 500 Server Error: Internal Server Error ( “Cannot start container 1c1…d7051: setup mount namespace mounting /var/lib/docker/vfs/dir/575…9f73 into /var/lib/docker/devicemapper/mnt/1c1f7f…1edd7051/rootfs/etc/localtime not a directory”)
what is the solution?
Issue Analytics
- State:
- Created 8 years ago
- Comments:20 (1 by maintainers)
Top Results From Across the Web
Bind mounts - Docker Documentation
Bind mounts have limited functionality compared to volumes. When you use a bind mount, a file or directory on the host machine is...
Read more >Cannot bind mount a file that already exists in the container #5
C:\Users\m\src\phr\docker\local [develop ≡]> docker run -it -v ... Cannot bind mount a file that already exists in the container #5.
Read more >How can I use a local file on container? - Stack Overflow
Docker Machine tries to auto-share your /Users (macOS) or C:\Users (Windows) directory. So, you can mount files or directories on macOS using. ...
Read more >Docker is not updating the mounted file - Medium
The short explanation to this would be that Docker container single file bind mount strictly depends on the inode number.
Read more >Add local file mount to a container - Visual Studio Code
You can add a volume bound to any local folder by using the following appropriate steps, based on what you reference in devcontainer.json...
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
if host_config was deprecated in 1.2.3, where do I pass in binds now?
I think I’ve found the issue: can you try specifying the binds in the
create_container
call, like suchAnd see if that works?