我最近在 2016 年 10 月在此站点上发现了题为“如何在 openFOAM 的 docker 版本中挂载卷”的帖子。该帖子询问如何通过 Docker 版本的 openfoam 自动挂载(在 bash 或 csh 下)卷。希望这在下面得到解释。
我的情况是,在 下csh
,输出lsblk
是:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 1.8T 0 disk /mnt/hdd
sda 8:0 0 111.8G 0 disk
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 7.9G 0 part [SWAP]
└─sda1 8:1 0 103.9G 0 part /
然后我运行脚本startOpenFOAM+
,它是以下 Bash shell 脚本:
#!/bin/bash
# this script will
# i) Start OpenFOAM+ container with name 'of_v1612_plus'
# in the the shell-terminal.
# User also need to run xhost+ from other terminal
# Note: Docker daemon should be running before launching script
# PostProcessing: User can launch paraview/paraFoam from terminal
# to postprocess the results
# Note: user can launch script in different shell to have OpenFOAM
# working environment in different terminal
xhost +local:of_v1612_plus
docker start of_v1612_plus
docker exec -it of_v1612_plus /bin/bash -rcfile /opt/OpenFOAM/setImage_v1612+
我被转储到 Bash shell 中,lsblk
现在的输出是:
bash-4.1$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 1.8T 0 disk
sda 8:0 0 111.8G 0 disk
|-sda2 8:2 0 1K 0 part
|-sda5 8:5 0 7.9G 0 part [SWAP]
`-sda1 8:1 0 103.9G 0 part /etc/sudoers.d
我想问题的答案是将这一行添加docker run -v ....
到startOpenFOAM+
shell 脚本中。但是,我不确定用什么替换这些点以及在哪里放置命令。
任何帮助将非常感激。
谢谢,
彼得。