Rishi.Gupta Posted May 31, 2020 Posted May 31, 2020 Dear all I want to know how I can clone an existing docker so that I have 2 copies of the same docker running. I DO NOT want to install a fresh copy of the same docker (i have successfully done that by changing the name of the existing docker, and then installing agian using different ports). I have spent a lot of time and effort to configure a docker running RStudio. Now I want a second copy of that docker, but do not want to spend all that time configuring it again. So, the question is: How can I clone an existing docker so that I have 2 copies of it. Regards Quote
Squid Posted May 31, 2020 Posted May 31, 2020 Looking at it objectively The name HAS to be different. No way around it. If you're running in bridge mode, then the PORTS have to be different. Only one app can listen on a given port at a time If you're running in host mode, then you have to reconfigure the configuration within the app to reference a different port on one of the instances. (See next point) If the appdata for both instances point to the same config folder, then any config changes on one of the instances takes effect on both of them (ie: negates point above) If you run each app on it's own IP address, then technically yes you could completely share everything (except the name). BUT, then you would run into a caveat where each app *may* expect to have exclusive access to the appdata, and any changes one makes to it (saving metadata etc) may have unexpected consequences on the other instance since that instance may not be in a state that it will understand why what it assumes is it's appdata (that it assumes it has exclusive access to) suddenly for no reason just up and changed on it. YMMV Quote
Rishi.Gupta Posted June 1, 2020 Author Posted June 1, 2020 Hey @Squid. Thanks so much for your inputs! I do understand that the names and ports have to be different. I am happy to do that. Actually, I also installed a lot of Linux packages in the actual docker itself, so probably just sharing the appdata wont help duplicate the docker (or would it?). I do not expect any further changes to the docker, so i don't mind if they are completely independent of each other. I do not want a LIVE clone, just a clone. This could also maybe be helpful in case someone wants to copy a docker as it is to another system/platform. SO, is there any way (however complicated) to do it? PS: As a side question (off topic, if allowed): if I install a linux package in one docker, does it automatically become available in ALL dockers? Regards Rishi Quote
Rishi.Gupta Posted June 1, 2020 Author Posted June 1, 2020 OK. Will that also take care of any additional packages that were installed in the docker directly via bash? Quote
Squid Posted June 1, 2020 Posted June 1, 2020 Depends. You may have installed them within the docker.img itself (only you can answer that) which isn't the greatest idea to begin with. Any updates to the container, and in this circumstance all of your installations will be lost. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.