-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Can't pass host device or volume to container if host path contains colon #2041
Comments
The same error occurs if the colon appears in the bind mount path for the container, e.g. import docker
client = docker.from_env()
vols={'/somedir': {'bind': '/test:path'}}
client.containers.create("ubuntu:latest", volumes=vols) |
The volumes format is known to have some limitations, because it uses a colon as separator between options; does it work if you use Looks like you want to do a bind-mount, in which case you have to set |
@thaJeztah, thanks very much for the suggestion. Yes, I do want a bind mount. I thought I was specifying a bind mount by using the dictionary notation which specifies "bind" in the dictionary. Is the recommendation that the low-level API is required to accomplish a bind mount with a colon in the path? |
I'll have to defer that one to @shin-, I'm not very familiar with the docker-py sdk (or python, for that matter) 😊 |
Sorry for the confusion on the earlier thread.
import docker
c = docker.from_env()
mnt = docker.types.Mount(type='bind', source='/tmp/colon:colon/', target='/colon')
ctnr = c.containers.create('busybox', mounts=[mnt]) # <Container: 38869806cb> HTH |
Closing since this seems to have been answered. |
Steps to reproduce
Error
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: '/test:dir:/testdir:rw'")
Stack trace
Environment
docker-py: 3.3.0
Python: 2.7.15rc1
engine: 17.12.1-ce
Ubuntu 18.04
The text was updated successfully, but these errors were encountered: