Hey folks, I’ve got to find a way of translating my database which is housed in a CentOS vm with oracle EE and tomcat to Docker. Essentially I need a container which I can make API calls to.
Now I know that the 2 ways to tackle this are by:
Creating my own Docker image with a CentOS base, and oracle, java, tomcat, etc on top
Moving over the entire VM in a Docker image and maintain the same functionalities.
I’m really stuck because I looked at Rancher, and VBox images which just didn’t let me open up my .vmx file (p.s. They only let me use existing vm images). Another issue was that I couldn’t find a good base image which had normal cli functionality like sudo/yum/rpm.
Any recommendations or images that I should use to get this task done? I could really use the help!
Based only on this description, I’d approach this by:
Find a prebuilt Oracle container (this one seems to be popular).
Somehow copy the data from your existing database into the container (maybe there’s a data directory you can copy; maybe you need to create and restore a dump).
Write a Dockerfile that starts FROM tomcat:8.5, COPY your application into it, and configures it (probably to talk to the database on a fixed hostname); docker build it
Write a Docker Compose file that starts both pieces, making sure to start the database as the name the application expects
General Docker best practice is to run only one thing in a container and to connect together multiple containers. In your case, this helps reusability: none of my steps above started with “install Oracle”.
In particular trying to directly translate a VM into a Docker container tends to not be recommended. For it to work at all you frequently need to give up all of the host/container isolation, and things like network setup are really different between a container and a VM. If you have an existing VM, probably just running it as-is is both easier and better than trying to directly run the same filesystem image under Docker.