Output of docker version
:
Client:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 5604cbe
Built: Wed Apr 27 00:34:20 2016
OS/Arch: linux/amd64
Server:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 5604cbe
Built: Wed Apr 27 00:34:20 2016
OS/Arch: linux/amd64
Output of docker info
:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 21
Server Version: 1.11.1
Storage Driver: overlay
Backing Filesystem: xfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: host bridge null
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.64 GiB
Name: centos-dev
ID: ACEV:LLBJ:NOYB:VEHF:V3FO:JY3A:5ETY:ETCU:WM3D:DBGZ:YF25:BUTY
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Steps to reproduce the issue:
Describe the results you received:
Describe the results you expected:
I expected docker run
to support mount a local file using a relative path.
related issue: https://github.com/docker/docker/issues/22016
@subchen This is pretty much stated in the documentation
The container-dest must always be an absolute path such as /src/docs. The host-src can either be an absolute path or a name value. If you supply an absolute path for the host-dir, Docker bind-mounts to the path you specify. If you supply a name, Docker creates a named volume by that name.
- docker see that as a name for a volume, and thus, create the volume, create a folder for it inside and mount the volume in it.
- docker _still_ see that as a name for a volume but
/
is not allowed in the name of a volume, and thus it fails- working as expected :angel:
The reason why the docker
cli does not take relative path is because the docker client and the docker daemon might not be on the same host. Thus how should the relative path handled ?
I am going to close this as it is working as intended and documented, even if it is a bit confusing. If you feel the documentation should be improved please submit a patch!
You can do -v $PWD/../../path:/location
to use a relative path indirectly.
@vdemeester @justincormack thanks for your explains.
-v $PWD/../../path:/location
can resolve my issue.
Most helpful comment
I am going to close this as it is working as intended and documented, even if it is a bit confusing. If you feel the documentation should be improved please submit a patch!
You can do
-v $PWD/../../path:/location
to use a relative path indirectly.