Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application with Docker and mounted volumes #80

Open
antonylebechec opened this issue Aug 14, 2022 · 2 comments
Open

Application with Docker and mounted volumes #80

antonylebechec opened this issue Aug 14, 2022 · 2 comments

Comments

@antonylebechec
Copy link

Hi!

Is there a way to develop a Cloudgene application with a docker image that need to mount volumes (such as databases folders)?

Thanks a lot!

Best,

@ttbek
Copy link

ttbek commented Nov 9, 2022

Yes. There is no problem using it that way if I understood what you're asking. For instance, we spin up our Cloudgene Docker images like this:

sudo docker run -d --net="host" -v /home/cloudgene_data/:/data/ -v /home/assets:/opt/cloudgene/webapp/assets -v /home/cloudgene_data/apps/:/home/cloudgene_data/apps/ -e START_HADOOP="false" -v /var/run/docker.sock:/var/run/docker.sock --hostname OURHOSTNAMEGOESHERE NAMEOFCLOUDGENEDOCKERCONTAINERHERE

So we don't keep any app data in the container.
-v /home/cloudgene_data/:/data/ This is where application data lives, user uploads and their results.
-v /home/assets:/opt/cloudgene/webapp/assets This is where we keep customized HTML pages
-v /home/cloudgene_data/apps/:/home/cloudgene_data/apps/ And here we load the actual applications from outside the container as well, and yes we realize that inside the container this was accessible at /data/apps/, but if I remember correctly (which I might not be) Cloudgene expects the apps at this other location.
-e START_HADOOP="false" We don't use Hadoop.. so yeah
-v /var/run/docker.sock:/var/run/docker.sock This neat little bit lets us spin up other docker containers from our Cloudgene docker container, which we use because some of our apps we have built in the form of docker containers. THIS MAY HAVE SIGNIFICANT SECURITY IMPLICATIONS. In our use case the ability to perform root commands on the host (actually a VM in our case) from the docker container isn't a big deal, but it might be in your case, ask your local security professional before exposing this socket to your container.

So yeah, you can mount up whatever volume you might need to access.

Or did you mean that you need the application to dynamically mount a new volume? It's probably possible, if you can spin up a new docker container (as per above) then I would assume you can pass volumes to mount as it brings up that container that the app could work on.

Perhaps also see: https://jpetazzo.github.io/2015/01/13/docker-mount-dynamic-volumes/
And read about Docker bind mount propagation: https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation

@antonylebechec
Copy link
Author

Thanks or your answer!
Your explanation is perfectly clear.
I need to run a docker command with volumes that are not already mount in CloudGene container. So, I guess is what you mention as "dynamically mount".
To do that, I'll probably use the "BashCommand" step (app with a script including "docker run -v ...") instead of the "Docker" step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants