Search code examples
ubuntuamazon-ec2dockermount

Docker: Is it necessary to mount a new partition


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?


Solution

  • 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>`