mounting sdb on /mnt using docker and openfoam

I recently found the post entitled “How to mount volumes in docker release of openFOAM” post on this site on October 2016. That post asks about automatically
mounting an already mounted (under bash or csh) volume through the Docker version of openfoam. Hopefully, this is explained below.

I have the situation that under csh, the output from lsblk is:

  • Docker build error with vue-cli Webpack boilerplate
  • Kubernetes can't start due to too many open files in system
  • PHP file not found that should be found according to configured vHost
  • Kafka On Docker without docker-compose?
  • How to run a docker image in jenkins which is already in Docker Container
  • Possible to http clone repo to Docker Container?
  • 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 /
    

    Then I run the script startOpenFOAM+, which is the following Bash shell script:

    #!/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+
    

    I am dumped into a Bash shell and the output from lsblk is now:

    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
    

    I guess the answer to the problem is to add the line docker run -v .... into the startOpenFOAM+ shell script. However, I am not sure what to replace the dots with and where to place the command.

    Any help would be much appreciated.

    Thanks,

    Peter.

  • java process started inside a docker container not getting provided -Xms heap
  • docker base image: how to upgrade
  • Kubernetes and ERR_CONNECTION_RESET
  • Compose not working with Dockerfile using FROM
  • how to setup continuos deployment from docker-hub to AWS ECS?
  • Installing netstat on docker linux container
  • One Solution collect form web for “mounting sdb on /mnt using docker and openfoam”

    If I understand, you need this:

    docker run -v /mnt/hdd:/mnt/hdd .....
    

    But you didn’t showed where you docker run, if you find it, then add that -v.

    Important: you will not see a mount point with lsblk inside container regarding sdb, because docker mount a directory, not a device. You just will see contents in /mnt/hdd

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.