Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support mounting directories with a : (colon) in their path #1597

Closed
silviot opened this issue May 17, 2019 · 7 comments
Closed

Support mounting directories with a : (colon) in their path #1597

silviot opened this issue May 17, 2019 · 7 comments

Comments

@silviot
Copy link
Contributor

silviot commented May 17, 2019

Description

Currently [there is no way to mount a directory with a colon in its name (e.g. /tmp/aa:bb) neither as source nor destination.
This is the code that parses the mounts.

Steps to reproduce the issue:
Try to mount a directory with a colon in its name.

buildah run -v /some:dir:/destination container-name

Suggested solution
Support the same syntax docker supports, with --mount in addition to -v/--volume.

@TomSweeneyRedHat
Copy link
Member

@silviot thanks for the issue. We'd a similar problem with envvars yesterday in Podman, this one might be a little bit more entertaining as we allow for the format host-dir:ctr-dir[:option]. Should be fixable though, will take a look.

@TomSweeneyRedHat TomSweeneyRedHat self-assigned this May 17, 2019
@rhatdan
Copy link
Member

rhatdan commented May 17, 2019

I am not sure how fixable this is. Does Docker support this?

@silviot
Copy link
Contributor Author

silviot commented May 20, 2019

@rhatdan Docker supports it since version 1.13.0. For example to mount the directory /tmp/aaa:bbb on the host to /cc:dd in the container one could use something like this:

docker run --rm -ti --mount type=bind,src=/tmp/aa:bb,dst=/cc:dd alpine sh

This is the commit that introduced support for this option type:
docker/cli@3375ba2
And this is the pull request that introduced the feature.

I thought it would be useful to dig these up and mention them in this issue, but I'm not 100% sure that's the right piece of code. In case it isn't please speak up and bear with me: I never used go.

@rhatdan
Copy link
Member

rhatdan commented May 20, 2019

If that does not work on Podman then that is an issue, but you were asking for

podman run -v /tmp/aa:bb:/cc:dd alpine sh
To work in the opening issue.

Does

docker run -v /tmp/aa:bb:/cc:dd alpine sh

Work?

@silviot
Copy link
Contributor Author

silviot commented May 20, 2019

@rhatdan My first example under "Steps to reproduce the issue" shows what a user would do after reading the documentation to mount directory /tmp/aa:bb. I'm not advocating to make that syntax work.

I think a good solution to this problem would be to support an additional option besides -v as docker does.

docker run -v /tmp/aa:bb:/cc:dd alpine sh

will not work, but the example I gave with --mount will. Here it is again:

docker run --rm -ti --mount type=bind,src=/tmp/aa:bb,dst=/cc:dd alpine sh

I only see buildah lacking this feature, because I don't use podman. I imagine it might suffer from the same issue, but personally I only know about buildah.

@rhatdan
Copy link
Member

rhatdan commented May 20, 2019

podman version
Version:            1.3.1
RemoteAPI Version:  1
Go Version:         go1.12.2
OS/Arch:            linux/amd64
$ mkdir /tmp/aa:bb
$ podman run --rm -ti --mount type=bind,src=/tmp/aa:bb,dst=/cc:dd alpine sh
# id 
uid=0(root) gid=0(root)
# ls -l /cc:dd
total 0

Works now with Podman.

@silviot
Copy link
Contributor Author

silviot commented May 20, 2019

podman version
Version:            1.3.1
RemoteAPI Version:  1
Go Version:         go1.12.2
OS/Arch:            linux/amd64
$ mkdir /tmp/aa:bb
$ podman run --rm -ti --mount type=bind,src=/tmp/aa:bb,dst=/cc:dd alpine sh
# id 
uid=0(root) gid=0(root)
# ls -l /cc:dd
total 0

Works now with Podman.

Please note I opened this ticket for a problem I had with buildah, and I never used podman: I'm currently using buildah to build containers that will run in a docker environment. I'm very happy about the features buildah offers over docker to build container images.
But I can't mount a directory with a colon in its path using buildah.

I understand now (I did not when I opened the ticket) that I can use the workaround outlined here to solve this problem, and I will use it for my immediate needs.
I still think it would be very nice for buildah to support the same --mount option podman supports.

@rhatdan rhatdan assigned QiWang19 and unassigned TomSweeneyRedHat Jun 8, 2019
QiWang19 added a commit to QiWang19/buildah that referenced this issue Jun 14, 2019
close containers#1597

Enables to use path with colon when using `buildah run --volume` to bind a volume. Have the same functionality as --volume.

Signed-off-by: Qi Wang <qiwan@redhat.com>
QiWang19 added a commit to QiWang19/buildah that referenced this issue Jun 17, 2019
close containers#1597

Enables to use path with colon when using `buildah run --volume` to bind a volume. Have the same functionality as --volume.

Signed-off-by: Qi Wang <qiwan@redhat.com>
QiWang19 added a commit to QiWang19/buildah that referenced this issue Jun 21, 2019
close containers#1597

Signed-off-by: Qi Wang <qiwan@redhat.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants