Perhaps I’m just searching for the entirely wrong things, but I can’t seem to figure out how to specify a directory for a volume in either Podman or Docker. The documentation hasn’t helped much, since I can’t find anything referencing to my problem.
I’m trying to mount a 2nd drive (/mnt/sdb/), but every solution leaves the mountpoint at the default location. (/home/user/.loca/share/containers/volumes/so-on-so-forth/)
Any help would be greatly appreciated.
Without more information, I’d say you’re looking for
podman run --volume /mnt/sdb/:/path/inside/your/container
. Check the manpage for podman runCan you post what you’re trying? IE your run command or compose file?
The podman docs describe it as follows
If -v /HOST-DIR:/CONTAINER-DIR is specified, Podman bind mounts /HOST-DIR from the host into /CONTAINER-DIR in the Podman container. Similarly, -v SOURCE-VOLUME:/CONTAINER-DIR mounts the named volume from the host into the container. If no such named volume exists, Podman creates one. If no source is given, the volume is created as an anonymously named volume with a randomly generated name, and is removed when the container is removed via the --rm flag or the podman rm --volumes command.
Is that what you’ve been doing?
Please share the commands you’ve been trying
Using podman-compose, I usually have a section like:
volumes: - ./local_folder:/container/folder
Specifically, I have to use either an absolute path or a relative path with “./” to prevent it from treating a directory as a volume name.