Help with docker - easy questions :)

Hello,

Sorry for my poor english :smile:

I’m experiencing docker as a webhost system. What I’m trying to do is :

Have an external NFS server (not an instance, a real server) with 1 export per hosted domain :
/nfs-exports/domain1.com/www/
/nfs-exports/domain2.com/www/
and so on

Have a base image with apache, php, and modules built inside.
Start 1 instance per domain from my superb image created before. Each of these instance should nfs mount their /var/www from the nfs server, have their apache configuration loaded from docker instance config file.

Right now, I’m stuck on some things, and I’m sorry but I couldn’t get it right with online tutorials…
I built successfully my base image with packages I need.
I successfully started 1 container with port redirection, so I can access my apache server inside my container from external computer.

Problem 1 :
I can’t get the nfs mount to work. I can nfs mount from my docker server, but can’t from containers, I get ā€œaccess denied by serverā€. TCPdump show no incoming packets on the nfs server when I try to mount from container, so I guess there is a problem that my docker server won’t let NFS packets going out. But I can ping from container to nfs server …
From what I dig on google, I think I’m doing it the wrong way : I should mount a share on the docker host, then share it to the container ? Is it how I should get it done ?

Problem 2 :
Can anyone lead me to an easy tutorial on how to work with docker configuration files?
Ideally I’d like to have a configuration file like :
domain=domain1.com
var1=aaaa
var2=bbbb

Then when I start my container for the domain1.com, I’d need to get these variables inside my container so it would initialize my apache with good values.

Problem 3 :
Starting a container with a bash script that calls service apache2 start will immediatly ends, because no program runs in front as apache service will start as a background daemon.

What would be the good way to start my container ? I thought using an init script like :

-write good config files for apache
-mount nfs with www files
-service apache start
-what to do here? infinite loop ?

Is that the good way ?

Thanks for all the help you could provide me :smile: