Docker Community Forums

Share and learn in the Docker community.

Docker not mounting /etc/fstab at boot/start up


#1

Hello,

I have an Ubuntu 18 image and I can correctly start with docker run and the container runs fine, except that the content of the /etc/fstab file is not mounted when the container is up and running.

//99.99.99.99/dirname /shared/otherdirname cifs credentials=/etc/fstab.password,iocharset=utf8,noperm,vers=2.1 0 0

where 99.99… is of course a to be replaced with the correct IP address. Credentials and file access rights are OK, after boot using mount -a as root mounts the fstab entries correctly !

Why it is not mounted at boot time ? How I can mount it ?

Thanks a lot,
Gergely


(Metin Y.) #2

You are aware that a container is not a vm, aren’t you?
Only commands defined in the entrypoint script are executed.
If you desperatly want this to happen, you have to enhance your entrypoint script to perform the tasks requried!

Though, your approach is not the typical docker solution for this task. Either Mount the share and map it into the container OR create a volume that does it for your. If you want the volume approach you might want to write a compose file for it and use cifs with the local driver.


#3

Hi !
Sure, yes I’m aware of that :wink: I’ve also tried with the entrypoint approach but it was not working… will keep debugging. Anyway, thanks for the suggestion, I’ll follow that !

Gergely