1

I want to install a product on Docker. It was previously installed on an EC2-server of Amazon.

The installation starts with creating a mount point /product. Than they partition a disk with fdisk and they're creating a new partition. After that they create a filesystem and mount the new partition to /product.

I'm not familiar with this but it seems to me that the main goal is to install the product on one new disk.

The installation was performed on an Ubuntu:14.04 So I just want to start like this:

docker run -i -t ubuntu:14.04 /bin/bash

Performing the same installation instructions and create an image of the container.

Is it necessary to perform something of the mount instructions or can I just start the installation?

1 Answers1

0

perform something of the mount instructions

Not exactly.
The best practice is to define your installation step in a Dockerfile, starting with from ubuntu:14.04, and including a VOLUME /mount in order to declare /mount as a volume.

This is preferred to a docker run + (work) + (exit) + docker commit, because with a Dockerfile, you can easily repeat the installation process with a simple docker build. And you keep the specification of that installation written in the Dockerfile.

The alternative would be to go your way, and then try to extract a Dockerfile from the resulting image.

In that case, docker commit allows to apply some Dockerfile instruction to the image created.
Typically, the mount would be done at that time:

docker commit -c='VOLUME /mount'` <yourcontainer> <yourimage>`
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yes I know a Dockerfile and use it often. But this installation is pretty long and complex. So It would be difficult to write it in one Dockerfile (surely at the beginning). Is it possible to generate a Dockerfile from a container or image? –  Jan 21 '16 at 09:15
  • @Jenson Not that I know of. – VonC Jan 21 '16 at 09:15
  • @Jenson I stand corrected. I have edited the answer. – VonC Jan 21 '16 at 09:17
  • @Jenson But as you comment, the resulting Dockerfile might not include *everything*. – VonC Jan 21 '16 at 09:17
  • Thanks. Could you explain me what the VOLUME /mount will be translated in shell commands? (So I first try to perform it inside the container and later on I translate into a Dockerfile) –  Jan 21 '16 at 09:42