Skip to content

Support for relative path in bind mounts - #1273

Closed
matthewwo wants to merge 4 commits into
docker:masterfrom
matthewwo:1203-relative-bind-mounts
Closed

Support for relative path in bind mounts#1273
matthewwo wants to merge 4 commits into
docker:masterfrom
matthewwo:1203-relative-bind-mounts

Conversation

@matthewwo

Copy link
Copy Markdown

Signed-off-by: Matthew Wo 9029537@gmail.com

- What I did
Add support for resolving relative paths in bind mounts as discussed in #1203.

For example:

docker run -v ./data:/data-dump my-image

will mount the folder data in the current working directory.

- How I did it
Made changes in the parser (opts.go) to resolve the relative path but only if the volume is a bind mount.

- How to verify it

docker run -v ./hello:/hello-folder alpine sh -c "touch /hello-folder/test"

the folder hello in the current working directory of the host machine should have the file test.

- Description for the changelog

Resolves relative path in docker run bind mounts.

- A picture of a cute animal (not mandatory but encouraged)
baby-anteater

Zot Zot Zot (as an UCI alumni).

Signed-off-by: Matthew Wo <9029537@gmail.com>
@GordonTheTurtle

Copy link
Copy Markdown

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "1203-relative-bind-mounts" git@github.com:prankymat/cli.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354231528editor openschange each 'pick' to 'edit'save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

Signed-off-by: Matthew Wo <9029537@gmail.com>
@matthewwo
matthewwoforce-pushed the 1203-relative-bind-mounts branch from de2ae19 to 026fef4CompareAugust 5, 2018 16:22
@dice14u

Copy link
Copy Markdown

--- FAIL: TestParseWithVolumes (0.00s)
opts_test.go:157: Error parsing volume flags, /hostTmp:/containerTmp:ro and /hostVar:/containerVar:rw did not mount-bind correctly. Received [/hostVar:/containerVar /hostTmp:/containerTmp:ro]

Comment threadcli/command/container/opts.go Outdated
@ianfrantz

Copy link
Copy Markdown

Hi folks, I'm still having trouble getting this to work on Windows 10.
What am I missing?

My solution:

$wd = Get-Location
#Set-up the Container:
docker run --name MSSQL-Latest
-p 1433:1433 -e "ACCEPT_EULA=Y"
-e "SA_PASSWORD=F00B4rB4z!" -v $wd/DatabaseBackups:/src
-d mcr.microsoft.com/mssql/server:latest

@Stadly

Copy link
Copy Markdown

Any news on this? Would be great!

@santalucial

Copy link
Copy Markdown

most anticipated feature of 2020

@c-goes

Copy link
Copy Markdown

Podman has this feature. Please do it also in Docker CLI.

@svdHero

Copy link
Copy Markdown

Any update? This would be such a great feature.

@matthewwo

Copy link
Copy Markdown
Author

Seems addressed by #3469

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@matthewwo@GordonTheTurtle@dice14u@ianfrantz@Stadly@santalucial@c-goes@svdHero@fredrik@thaJeztah