Thank you Mark, very informative. I think below is what I have going on - 
Therefore the volumes have to be there or it fails. If I take the volume 
references out, the guacamole container keeps restarting as a result of the 
mapping not being there:

If you preset GUACAMOLE_HOME, the container is expecting to be able to use
that as a template for the actual guacamole home directory. But the
container can only see folders inside the container or those on the host
that are linked by volumes. So, if you don't have the volume, the container
cannot see the folder and won't copy anything in.



    On Monday, July 16, 2018, 3:05:42 PM EDT, Mark Nolan <[email protected]> 
wrote:  
 
 TL;DR

Assuming I have understood your requirements correctly, then "yes".

More details below if you find this stuff useful.

M.
.


What does the docker container do when it starts up?

If you read shell script, it may help you to look at the start.sh script in
the docker container. Here is an extract:


GUACAMOLE_HOME_TEMPLATE="$GUACAMOLE_HOME"

GUACAMOLE_HOME="$HOME/.guacamole"

... snip ...
#
# Start with a fresh GUACAMOLE_HOME
#

rm -Rf "$GUACAMOLE_HOME"

#
# Copy contents of provided GUACAMOLE_HOME template, if any
#

if [ -n "$GUACAMOLE_HOME_TEMPLATE" ]; then
    cp -a "$GUACAMOLE_HOME_TEMPLATE/." "$GUACAMOLE_HOME/"
fi


So, if the environment variable GUACAMOLE_HOME is set when the script
(container) starts, then it is copied to the variable
GUACAMOLE_HOME_TEMPLATE. The GUACAMOLE_HOME is set to $HOME/.guacamole.
Later, it clears out GUACAMOLE_HOME and copies the full contents of
GUACAMOLE_HOME_TEMPLATE into GUACAMOLE_HOME.

If you preset GUACAMOLE_HOME, the container is expecting to be able to use
that as a template for the actual guacamole home directory. But the
container can only see folders inside the container or those on the host
that are linked by volumes. So, if you don't have the volume, the container
cannot see the folder and won't copy anything in.

Note that you absolutely CANNOT mount the volume as $HOME/.guacamole since
that will cause the template and the real guacamole home to be the same
directory.



On 16 July 2018 at 14:45, Tezarin <[email protected]> wrote:

> Thank you Mark. I apologize for the format of the docker-compose all being
> scrambled in my previous email, I've attached it in a file hopefully it's
> more readable.
>
> So if I understand you correctly, in order for my container to be able to
> inherit the contents of the host's /opt/guacamole-home directory, I should
> have a volume. So if I take those lines out where the volume gets
> referenced, and just define the environment variable, it won't work. Did I
> understand you correctly?
>
> Thank you
>
> On Monday, July 16, 2018, 2:15:12 PM EDT, Mark Nolan <[email protected]>
> wrote:
>
>
> I am not a docker compose user and I'm finding your yaml very hard to read
> in the email, but simply put, the behaviour of the docker container is:
>
> - If GUACAMOLE_HOME is set when the container starts, then treat that
> folder as the start of the real guacamole home, copying the contents
> across. Add to it any requirements from other options (e.g. install the
> mysql extension and add mysql parameters to any existing
> guacamole.properties).
> - If GUACAMOLE_HOME is not set, then just create a guacamole home from
> scratch copying in any required extensions.
>
> If your template guacamole home directory is on the docker host, then it
> must be exposed to the container as a volume, otherwise the corresponding
> folder inside the container will not exist or will be empty and nothing
> will be copied across.
>
> Is that clear? Does it answer your question?
>
> Regards,
> Mark.
> .
>
>
>
> On 16 July 2018 at 12:17, Tezarin <[email protected]> wrote:
>
> > Hi all,
> > I have Guacamole running inside the docker containers (guacd and
> > guacamole),  I'm trying to add a new environment variable to my Guacamole
> > docker-compose file to set the Guacamole home to /opt/guacamole-home.
> > On the docker host machine I have created the /opt/guacamole-home
> > directory and have several files in there. In my docker compose file I
> have
> > these lines added:
> >  guacamole:    build: .    image: Myimage/guacamole    volumes:      -
> > guacamole-home:/opt/guacamole-home    restart: always..environment:-
> > GUACAMOLE_HOME=/opt/guacamole-home...volumes:  guacamole-home:
> > My Dockerfile's base image is FROM guacamole/guacamole
> > I understand the base image (guacamole/guacamole) does not have the
> > guacamole-home defined. So I took the  volume lines out of my
> > docker-compose out so it looks like this:
> > guacamole:    build: .    image: Myimage/guacamole    restart: always...
> > But now, those files I  have  in the  host machine's  /opt/guacamole-home
> > do no get copied to the container with t his  error;
> > cp: cannot stat '/opt/guacamole-home/.': No such file or directory
> >
> > The upstream image does not have the guacamole-home defined.  If  I want
> > the content of the host machine's /opt/guacamole-home to  get copied to
> the
> > /opt/-guacamole-home inside the Guacamole docker container, will I have
> to
> > add those volume lines back  in?
> > Thanks
> >
>
  

Reply via email to