Mount specific file in docker container

Locked
chrishane
First post
Posts: 1
Joined: Thu May 18, 2017 9:31 am

Mount specific file in docker container

Post by chrishane »

Is it possible to mount a specific file when using Container in a QNAP (251+)?

I would like to run the docker command like:

> docker run -v /path/filename.ext:/tmp/filename.ext

I know how to setup and mount directories o QNAP. Trying to figure out how to mount a file.

Thoughts?

Thanks,
Chris....
osuhickeys
Starting out
Posts: 27
Joined: Thu Mar 15, 2012 4:34 am

Re: Mount specific file in docker container

Post by osuhickeys »

Curious if anyone ever figured out how to do this. Appears you can only mount folders, not individual files.
djgrazzy
Starting out
Posts: 17
Joined: Wed Jul 20, 2011 11:52 am

Re: Mount specific file in docker container

Post by djgrazzy »

I too came looking for this answer. So many times it's called for :(

To add some additional info for anyone else reading.

Container Station Shared folders only allows Volume from host "folders" in the drop down selection with no way to type and override or type
Example An image might have the command --config /ddns-route53.yml
so
Volume from host > Mount Point
/Container/mounts/ddns-route53 > /ddns-route53.yml

This results in "no such file or directory" when starting the container.
I have tried changing the command to
--config /route53config/ddns-route53.yml
and updating the shred folder
Volume form host > Mount Point
/Container/mounts/ddns-route53 > /route53config/ddns-route53.yml
But the same no such file error on startup.

It would seem QNAP need to allow the drop down field to be manually typed. I might submit a ticket and comment back with what they say.


My current workaround is to create an APP (vs single container) which allows specifying in the volume.
I don't believe APPs can be used when host networking is required?

Create > Create Application (right hand side)

Create a docker compose formatted YAML file

version: "3.2"
services:
ddns-route53:
image: crazymax/ddns-route53:latest
container_name: ddns-route53
volumes:
- "/share/Container/mounts/ddns-route53/ddns-route53.yml:/ddns-route53.yml:ro"
environment:
- "TZ=Australia/Melbourne"
- "SCHEDULE=* * * * *"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
restart: always

EDIT: A bunch of typos
djgrazzy
Starting out
Posts: 17
Joined: Wed Jul 20, 2011 11:52 am

Re: Mount specific file in docker container

Post by djgrazzy »

Hi Guys,
A better workaround it to simply ssh into the QNAP and use docker run, they then appear in container station as normal after ward.

Eg

docker run -d --name="ddns-route53docker" \
--restart always \
--cpus=".5" \
--memory="512m" \
-e TZ="Australia/Melbourne" \
-e SCHEDULE="* * * * *" \
-e LOG_LEVEL="info" \
-e LOG_JSON="false" \
-v /share/Container/mounts/ddns-route53/ddns-route53.yml:/ddns-route53.yml:ro crazymax/ddns-route53:latest


Docker honors --cpus and --memory" ( can verfied with the cmd "docker stats" (ctrl + C to break, use "docker container ls" to match up container id's)
but these aren't reflected in container station gui
djgrazzy
Starting out
Posts: 17
Joined: Wed Jul 20, 2011 11:52 am

Re: Mount specific file in docker container

Post by djgrazzy »

FYI, QNAP replied with the same thing :D

QNAP Technical Support has updated the support ticket
Our developers has confirmed the option to mount files are not available currently, though have advised that they will plan this into the road map for potential implementation on future versions.
As a work around, the developers suggested you could login to the NAS via ssh and use the "docker run" command to mount files.
Hope that helps. Please let us know if you have other questions or issues.
Best Regards,
Q-nap
Starting out
Posts: 45
Joined: Fri Jul 30, 2021 10:16 pm

Re: Mount specific file in docker container

Post by Q-nap »

Just found this. I logged a call with Qnap about this a few days and just spent the last few days playing around. Why didn't they point me here or explain?

It seems that after 3 years they still have not implemented this basic function
Since this thread it has been updated and they managed to remove LXC easy enough.
Seems to me they just released an Alpha version and then just tinkered with it after that.
Crazy.
Locked

Return to “Container Station”