When you bind a volume using docker, the host directory path cannot be relative:
This won't work:
-v data:/data
Change to a absolute path like -v ~/Downloads/data:/data
or -v /home/user/Downloads/data:/data
If still you see the same error, make sure the file httbin.yml
exists in out data
folder
Note: The -v
flag is very flexible. It can bindmount or name a volume with just a slight adjustment in syntax. If the first argument begins with a /
or ~/
, you’re creating a bindmount. Remove that, and you’re naming the volume.
-v /path:/path/in/container
mounts the host directory, /path
at the
/path/in/container
-v path:/path/in/container
creates a volume named path
with no relationship to the host.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…