Docker

 
 
Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux. Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting virtual machines.

The latest Docker version can be downloaded from: http://www.docker.com

rss feed






Export and import a Docker image



Information
There are two ways to export and import a Docker image:
  • Method 1:
    • Save a docker image to a tar file.
    • Export it from the Docker host.
    • Import it to another Docker host.

  • Method 2:
    • ????
    • ????
    • ????
Operating system used
Windows Vista Home Premium SP 2

Software prerequisites
Docker on Windows


Procedure
  1. Method 1:
    Show all stored Docker images, type: docker images

    Show all docker images

  2. Start an Ubuntu container and change this container by creating a file, type:
    docker run unbuntu /bin/bash -c "echo 'Good morning' > /tmp/test2.txt"

  3. To show the container id, type: docker ps -a

    Show container id

    The container id is "8893ffc1dee6"

  4. Save the modified container to an image, type:
    docker commit 8893ffc1dee6 happy_fish

  5. Show all stored Docker images, type: docker images

    Saved image happy_fish

    The image "happy_fish" is created.

  6. The image "happy_fish" is based off the Ubuntu 14.04.2 image, to verify this type:
    docker images --tree

    Tree hierarchy with image happy_fish

  7. Show all commands which were applied to create this images, type:
    docker history happy_fish

    Show history of image happy_fish

  8. Export this Docker image, type:
    docker save -o /tmp/new_file.tar happy_fish

  9. To check if this tar file is created, type:
    ls -al /tmp/new_file.tar

  10. To share files between VirtualBox (Ubuntu) and your host computer (Windows) you need to make the following changes:
    • On your host (Windows) create a directory: c:\vboxshare
    • Start the Oracle VM VirtualBox Manager and stop all VM.
    • Select the VM you wish to export/import files.
    • Press the Settings button.
    • Select menu "Shared Folders"

      VirtualBox shared folders

    • Press the + button on the right and enter:
      Folder Path: c:\vboxshare
      Folder Name: vboxshare
      Enable: Auto-mount
      ... and press Press OK button.

      Add shared folder

    • Press OK button

      Shared folder overview

    • Start the VM.

    • The shared folder appears on your guest machine as: /media/sf_Vboxshare

    • Add any user in your guest systrem that needs access to the shared folder to the group "vboxsf":
      sudo adduser $USER vboxsf

    • Add any user in your guest systrem that needs access to the shared folder to the group "vboxsf":
      sudo adduser $USER vboxsf



  11. XXXXXXXXXXXX