我有这个脚本,用于在Ubuntu Docker容器中挂载Windows共享文件夹。您必须在图像中复制脚本。
然后,您应该运行容器,然后调用以下命令:
docker exec container_name mkdir -p %shared folder inside docker path%
docker exec container_name /bin/bash /~path to your script~/mount_folder.sh %username% %password% %network_path% %docker_path%
例如:
docker exec container_name /bin/bash /~path to your script~/mount_folder.sh "Admin" somePassword //192.168.7.1/shared_folder /data
脚本为(mount_folder.sh):
#!/bin/bash
set -e
USERNAME=${1}
PASSWORD=${2}
NETWORK_PATH=${3}
DOCKER_PATH=${4}
mount -t cifs -o rw,username="${USERNAME}",password="${PASSWORD}",vers=3.0,nolock $NETWORK_PATH $DOCKER_PATH
本文链接:https://www.f2er.com/2055453.html