Home > Blockchain >  docker bind mount volume named like "ts_00:00:00", i.e. with a column in name
docker bind mount volume named like "ts_00:00:00", i.e. with a column in name

Time:04-26

I realized that I am unable to execute bind mount with a volume that has a column in name, e.g.

docker run -v /mnt/fs/ts_00\:00\:00:/mnt/data container_name bash

fails with

docker: Error response from daemon: invalid volume specification: '/mnt/fs/ts_00:00:00:/mnt/data'.

I wonder if it is possible to get a volume with columns in the name to bind mount inside a docker container.

CodePudding user response:

use --mount instead of -v because colon is a the divider of source/target in the -v argument (source)

Was not sure if ts_00:00:00 is a file or a directory

I ran this and this works

mkdir "ts_00:00:00"
docker run --rm --mount type=bind,source=$(pwd)/ts_00:00:00/,destination=/tmp/hi -it bash

tried to prepare the command for you based on what you provided, but not sure if it's correct

docker run --mount type=bind,source=/mnt/fs/ts_00:00:00,destination=/mnt/data -it container_name bash

see more in the GitHub ishue

  • Related