idaholab / Malcolm

Malcolm is a powerful, easily deployable network traffic analysis tool suite for full packet capture artifacts (PCAP files), Zeek logs and Suricata alerts.
https://idaholab.github.io/Malcolm/
Other
327 stars 53 forks source link

use mount instead of volume in docker compose file to avoid creating empty directories for missing files #473

Open mmguero opened 1 month ago

mmguero commented 1 month ago

See Differences between -v and --mount behavior:

Because the -v and --volume flags have been a part of Docker for a long time, their behavior cannot be changed. This means that there is one behavior that is different between -v and --mount.

If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.

If you use --mount to bind-mount a file or directory that does not yet exist on the Docker host, Docker does not automatically create it for you, but generates an error.

Generating an error would be way preferable to creating an empty directory for our bind mounts.

As far as how to do this:

mmguero commented 1 month ago

As I have realized this is going to require some changes to install.py where we're adjusting the .yml, I'm going to bump this to a later release to handle it there.

I think the part we really want in the documentation is here: Volumes: Long Syntax

My rough-and-dirty attempt at find-and-replace in my text editor is:

Find: ^( )(-\s*)([^:]+):([^:]+)(:\w+)?$ Replace: $1 - type: bind\n$1 source: $3\n$1 target: $4\n$1 read_only$5\n$1 create_host_path: false

in install.py the calls to ReplaceBindMountLocation are what do this, which is found here. Changing from short form to long form will break this, so we'll have to adjust that when we do it.