Rakshu
Rakshu

Reputation: 11

Docker query on containerizing

Our requirement is to create a container for legacy apps over docker.

We don't have the operating system support/application server support available, nor do we have knowledge to build them from scratch.

But we have a physical instance of the legacy app running in our farm.

We could get an ISO image from our server team if required, our question is if we get this ISO image can we export this as a docker image?

if yes, please let me know if there is any specific procedure or steps associated with it.

if no, please tell me why? and the possible workarounds for the same.

Upvotes: 1

Views: 127

Answers (2)

Robert Moskal
Robert Moskal

Reputation: 22553

You will need to reverse engineer the application dependencies from the artifacts that you have in access to. This means recovering the language specific dependencies (whether python, java, php, node, etc). And any operating system level packages/dependencies that are required.

Essentially you are rebuilding the contents of that ISO image inside your docker file using OS package installation tools like apt, language level tools like pip, PECL, PEAR, composer, or maven, and finally the files that make up the app code.

So, for example: a PHP application might be dependent on having build-essential and php-mysql installed in the OS. Then the app may be dependent on packages like twig and monolog loaded through composer. If you are using SASS you may need to install ruby as well.

Your job is to track all these down and create a docker file that reproduces the iso image. If you are using a common stack like a J2EE app in tomcat, or a php app fronted by apache or ngnix, there will be base docker images that will get you most of the way to where you need to go.

It does look like there are some tools that can do this for you automatically: Dependency Walker equivalent for Linux?. I can't vouch for any of them. But you can also use command line tools. For example this will give you a list of all the user installed packages on a fedora system:

sudo dnf history userinstalled

When an app is using a dependency manager like composer or pip, there is usually a file that lists all the language specific dependencies.

At the end of the process you'll have a portable legacy app that can be easily deployed anywhere with a minimal footprint.

As one of the comments rightly points out, creating a VM from the ISO image is another way forward that will be much easier to accomplish. The application dependencies won't be explicit, but maybe that's ok for your use case.

Upvotes: 1

tgogos
tgogos

Reputation: 25250

if we get this ISO image can we export this as a docker image?

I don't think there is an easy way (like push-the-export-button) to do this. Explanation follows...

You are describing a procedure taking place in the Virtual Machine world. You take a snapshot of a server, move the .iso file somewhere else and create a new VM that will run on a Hypervisor.

Containers are not VMs. They "contain" all the bytes that a service needs to run but not a whole operating system. They are supposed to run as processes on the host.


Workarounds:

You will have to get your hands dirty. This means that you will have to find out what the legacy app uses (for example Apache + PHP + MySql + app code) and build it from scratch with Docker.


Some thoughts:

  • containers are supposed to be lightweight. For example one might use one container for the database, another one for the Apache etc... Your case looks like you are moving towards a fat container that has everything inside.
  • Depending on what the legacy technology is, you might hit a wall... For example, if we are talking about something working with old php, mysql you might find ready-to-use images on hub.docker.com. But if the legacy app is a financial system written in cobol, I don't know what your starting point might be...

Upvotes: 1

Related Questions