Mount host directory with a symbolic link inside in docker container

前端 未结 2 1299
抹茶落季
抹茶落季 2020-12-01 00:39

I mounted the container with this parameter:

-v /home/test/:/home/test

Inside /home/test in the host there is a symbolic link po

2条回答
  •  天命终不由人
    2020-12-01 00:53

    One solution is to make Docker mount the original file, but use readlink -f which prints the file's actual location. This way, you can still reference the symlink location in your command, e.g.

    docker run -it -v $(readlink -f /home/test/):/home/test/ ...

提交回复
热议问题