How to create a docker from a running application

Dear community,

OK, so I am trying to understand what this “docker” is all about. I have read many information here and other places and did some simple tests (usually hello-world) to check. I also looked at a git project subuser.

As usual for Opensource documentation does help, but is difficult to understand at first glimpse (ie. it helps usually the developer and the gurus that already figured it all out by trial and error.)

So this is what I would like to do, and I believe many users came this way to try to find a solution to this situation (framework):

You already have a VM/Vbox just to run, for exemple firefox browser, for testing purpose, safe browsing or security reason.

You had to setup the firefox browser with plugins and/or addons (or side executables for securiry reasons)
For instance many Corporations home workers and Internet banking and similar usually need to install a additional package to compliment the security of the browser (ie. apt-get install “something extra for firefox”)

Now you have used your VM/browser to access the system and registered your ID, set the cookies and addon gpg’s and your system is set and ready and you use it and all works good.

You decide to use the “docker” approach to avoid the need for VM/Vbox and also be able to make it “portable”

You will need to be able to exchange files between your “docker app” and the host local /home/ places just like you already do with your VM/Vbox solution

So how do I get my installation (without docker), in this case: firefox (installed using Virtualbox) in a docker container (without have to install firefox, addons, cookies, keys and certification validations of this all again ? Or do I need to install again every thing to make it a docker app ?

So can I make a working app (already installed in host OS) a docker version (a snapshot of the installed app on the OS)? Is this possible ? If I can how to I do this ? Is there a step-by-step ?

Hi,

I am not entirely sure that I understand what you are trying to do, but I will try to give you some leads based on my experience with Docker.

To build your own Docker image, you use a Dockerfile and describe what you want it to contain. That is described in the “Getting Started Tutorial” at https://docs.docker.com/engine/getstarted/step_four/. This gives you something that you can start and instead of having to re-install everything when you want to create a new container instance of the image, you get it from the start. See this as a provisioning of a new node.

So, now I have an OS with all the things installed and I do a change and want to create a new image. This is where you use the docker commit command. (https://docs.docker.com/engine/reference/commandline/commit/)

What this does is take the running container, halt it, and store it as a new image. I use this when I want to test different settings of running applications and don’t want to have multiple Dockerfiles. I do however recommend that you use Dockerfiles to manage your images as far as possible.

A quick step by step that I use to teach Docker:

  1. $ docker pull alpine
  2. $ docker run -it alpine /bin/sh
  3. / curl

  4. command curl not found
  5. / apk add -update curl

  6. curl: try ‘curl --help’ or ‘curl --manual’ for more information

Now I hit Ctrl-p Ctrl-q to detach from the container.

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
677b7e1ea7c9 alpine “/bin/sh” 5 minutes ago Up 5 minutes cranky_joliot

This gives me the container id so I can commit it.

$ docker commit 677b7e1ea7c9 alpine_curl

And now I can run

  1. $ docker run -it alpine_curl /bin/sh
  2. / curl

And instantly get the curl command without having to install it.

https://hub.docker.com/r/tramasoli/firefox-image/

there is a draft docker image with firefox. You could try it. Later would need to install your plugins as well.

Dear Ove Lindström and think,

Thank you for the reply.

I may not have been clear enough about what I would like to do (or if it is possible with this tool).

So I will give you a working example.

I have a installed on my desktop workstation (ubuntu 14.04.5 / i386 ), with no docker packages yet, a Mozilla Firefox browser with java plugin.

Now the Internet bank imposes that you need to install a deb package to alter your network and browser to meet there security requirements. But this has many side effects when you are not using Internet banking. So how can I use “docker” strategy to isolate this new deb package from my stable system and only use it when using Internet banking.

This is the Internet bank download page: https://seg.bb.com.br/home.html#en
(In english to be more simple to understand the problem).

Cheers!

try to start the firefox docker image above.
if you could get it started and you get used to it, then try to alter it to fit your needs…install your plugins, remove things which you do not like, install the bank debian packet, … after all that tag it as your image, probably also put an icon on your desktop and be happy. :slight_smile:

I just agree with what @think is saying. There is no way to use docker to swap in and out deb-packages so that you can use the normal OS browser and just start and stop the docker image depending on what you want.

I normally use a VM for this and not Docker. IMHO, docker is NOT another VM.