Docker Community Forums

Share and learn in the Docker community.

Dockerize Previously Installed Applications


(Circlex) #1

Hi,

I have an old Ubuntu 10.04 OS with a Python multi player network game that utilizes Apache2, MySQL, Dns masquerade and PHP. Would I be able to Dockerize these applications directly from the hard drive they currently reside on and in the state they are currently in? Or to put it another way; could I essentially transfer or (Clone) the required directories and files over to Docker and keep the existing setup files without needing to reinstall everything from scratch? Please Generalize the process for doing this if you can.


(Sam) #2

there is no general purpose tooling to do something like this…

it looks like this is really an apache php app that uses database (lamp stack)

so, you could setup an apache/php container (using the lamp stack image)
and a mysql container… (using the mysql image)
backup and restore the mysql database. or use the folder as a volume into the database…
but might have sql version issues… back/restore is better in my opinion…

then you could migrate the apache/php config to the new container…
and change the mysql connection to talk to the other container instead of localhost
and copy the php code to the web root
you could use volumes (docker run -v) here too maybe… but if u want longer term isolation from the OS,
i would copy the app into the container. probably has no updates if it is that old.


(Circlex) #3

That all makes sense to me, however, at this time I am not sure if the Python server will have any issues with a newer version of MySQL. Seems logical though that it wouldn’t as long as I point the connection properly and use back/restore.

The game client is essentially a jQuery web app that communicates directly through custom packets with the Python game server, which then directly manages a number of tables in the database. The game server uses MySQL, Munin-Node, Memcached and Twisted to facilitate game play. Also, when you say copy the app into the container; do you mean copy the folders containing the binaries and the libraries? Would this work for the python server also?


(Sam) #4

yes, copy… python is script, if there are some binaries, who knows… i would run the latest python version…always issues when u upgrade something…

the docker runtime is quite new compared to ubuntu 10… so no idea what will break.

you could ‘try’ by using docker volumes -v host_path:container_path (note that there are limitations on the root of the host_path), which would let you test without moving any of the app code.


(Circlex) #5

Ok, thanks for the info. I think I have enough to get started!