Skip to content

Docker run scripts - mount specific directories

Jolie Roiseux requested to merge feature/docker-mount-specific-directory into develop

Context

The two options for mounting directories with the docker-run-*.sh scripts (--dev or no flag), were limiting for users who may store their data files elsewhere on their machine. The script should allow users to specify another path to mount into the container.

There was also no script for Windows users to run the Docker container.

Summary

Users can now choose to run the script with no flags, the -p <pathtodata> flag, the -d flag (-d replaces --dev), or both the -p and -d flags.

  • If using no flags, the ntp/ and experiments/ directories in your vanwftk/ will be mounted into the container at /home/vanwftk/vanwftk/ntp and /home/vanwftk/vanwftk/experiments
  • If using the -p flag, specify an absolute path on the host's machine that will be mounted into the the /home/vanwftk/data directory in the container
  • If using the -d flag, your entire vanwftk/ directory containing the project will be mounted into the container at /home/vanwftk/vanwftk (the same as the --dev flag before)

The -p and -d flags can be used together.

There is a new scripts for PowerShell (./scripts/docker-run-windows.ps1) that should function the same as the other two existing scripts.

The DOCKER.md documentation file has been updated to reflect these changes and the new script.

How was this tested?

I tested all combinations using the osx script. The results were as expected and I could access and modify files with persistence.

./scripts/docker-run-oxs.sh

No directories specified; mounting default directories
          Mounting directory: '/Users/jolie/Projects/vanwftk/ntp' to '/home/vanwftk/vanwftk/ntp'
          Mounting directory: '/Users/jolie/Projects/vanwftk/experiments' to '/home/vanwftk/vanwftk/experiments'

./scripts/docker-run-osx.sh -p /Users/jolie/Projects/Triumf

Mounting directory: '/Users/jolie/Projects/Triumf' to '/home/vanwftk/data'
Mounting directory: '/Users/jolie/Projects/vanwftk/experiments' to '/home/vanwftk/vanwftk/experiments'

./scripts/docker-run-oxs.sh -d

Mounting directory: '/Users/jolie/Projects/vanwftk' to '/home/vanwftk/vanwftk'

./scripts/docker-run-osx.sh -p /Users/jolie/Projects/Triumf -d

Mounting directory: '/Users/jolie/Projects/Triumf' to '/home/vanwftk/data'
Mounting directory: '/Users/jolie/Projects/vanwftk' to '/home/vanwftk/vanwftk'

./scripts/docker-run-osx.sh -c (using an invalid option)

usage: ./docker-run-osx.sh [-p datapath] [-d]
              -p datapath: local path to experiment data
              -d:          use develop mode (mount code directory)

I tested the PowerShell script using PowerShell on mac, but it should still be tested on a Windows machine to make sure everything works correctly with the differences in paths between operating systems.

Edited by Jolie Roiseux

Merge request reports

Loading