<commit_before>.. meta::
    :author: Cask Data, Inc.
    :description: CDAP Docker Image
    :copyright: Copyright © 2014-2015 Cask Data, Inc.

============
Docker Image
============

.. highlight:: console


Docker is one of the easiest ways to start working with CDAP without having to manually
configure anything. A Docker image with the CDAP SDK pre-installed is available on the Docker Hub
for download.

To use the **Docker image**, you can either use Docker's :ref:`Kitematic
<docker-kitematic>` (on Mac OS X and Windows) |---| a graphical user interface for running
Docker containers |---| or start the container from :ref:`a command line <docker-command-line>`.

.. _docker-kitematic:

Docker using Kitematic
======================

`Docker Kitematic <https://www.docker.com/docker-kitematic>`__ is available as part of the
`Docker Toolbox <https://www.docker.com/docker-toolbox>`__ for either Mac OS X or Microsoft Windows.
It is a graphical user interface for running Docker containers. Follow these steps to install 
Kitematic and then download, start, and connect to an instance of CDAP.

#. Download and install the `Docker Toolbox <https://www.docker.com/docker-toolbox>`__ for 
   either Mac OS X or Microsoft Windows.

#. Start Kitematic. On Mac OS X, it will be installed in ``/Applications/Docker/Kitematic``; on 
   Windows, in ``Start Menu > Docker > Kitematic``.
   
#. Once Kitematic has started, search for the **CDAP image** using the search box at the
   top of the window. Then click on the repository menu, circled in red here:
 
     .. image:: ../../_images/kitematic/kitematic-1-searching.png
        :width: 8in
        :align: center

#. Click on the tags button:
 
     .. image:: ../../_images/kitematic/kitematic-2-tags.png
        :width: 4in
        :align: center

#. Select the desired version.
   Note that the tag **latest** is the last version that was put up at Docker Hub, which is not the 
   necessarily the most-current version:
 
     .. image:: ../../_images/kitematic/kitematic-3-select-tag.png
        :width: 4in
        :align: center

#. Close the menu by pressing the ``X`` in the circle. Press "Create" to download and start the CDAP image. 
   When it has started up, you will see in the logs a message that the CDAP UI is listening on port 9999:
 
     .. image:: ../../_images/kitematic/kitematic-4-cdap-started.png
        :width: 8in
        :align: center

#. To connect a web browser for the CDAP UI, you'll need to find the external IP addresses
   and ports that the Docker instance is exposing. The easiest way to do that is click on the
   *Settings* tab, and then the *Ports* tab:
 
     .. image:: ../../_images/kitematic/kitematic-5-links.png
        :width: 8in
        :align: center


#. This shows that the CDAP instance is listening on the internal port ``9999`` within the
   Docker instance, while the Docker instance exposes that port on the external IP address
   and port ``192.168.99.100:32769``. The text in blue is a link; clicking it will open it
   in your system web browser and connect to the CDAP UI:
   
     .. image:: ../../_images/kitematic/kitematic-6-cdap-ui.png
        :width: 8in
        :align: center


.. _docker-command-line:

Docker from a Command Line
==========================

- Docker is available for a variety of platforms. Download and install Docker in your environment by
  following the `platform-specific installation instructions <https://docs.docker.com/installation>`__
  from `Docker.com <https://docker.com>`__ to verify that Docker is working and has
  started correctly.
  
  If you are not running on Linux, you need to start the Docker Virtual Machine (VM) before you
  can use containers. For example, on Mac OS, use::
  
    $ boot2docker start
    $ boot2docker ip
    
  to determine the Docker VM's IP address. You will need to use that address as the host
  name when either connecting to the CDAP UI or making an HTTP request.
  
  When you run ``boot2docker start``, it will print a message on the screen such as::

    To connect the Docker client to the Docker daemon, please set:
        export DOCKER_HOST=tcp://192.168.59.103:2375
        export DOCKER_CERT_PATH=/Users/.../.boot2docker/certs/boot2docker-vm
        export DOCKER_TLS_VERIFY=1<commit_msg>Fix docker download link<commit_after>.. meta::
    :author: Cask Data, Inc.
    :description: CDAP Docker Image
    :copyright: Copyright © 2014-2015 Cask Data, Inc.

============
Docker Image
============

.. highlight:: console


Docker is one of the easiest ways to start working with CDAP without having to manually
configure anything. A Docker image with the CDAP SDK pre-installed is available on the Docker Hub
for download.

To use the **Docker image**, you can either use Docker's :ref:`Kitematic
<docker-kitematic>` (on Mac OS X and Windows) |---| a graphical user interface for running
Docker containers |---| or start the container from :ref:`a command line <docker-command-line>`.

.. _docker-kitematic:

Docker using Kitematic
======================

`Docker Kitematic <https://www.docker.com/docker-kitematic>`__ is available as part of the
`Docker Toolbox <https://www.docker.com/docker-toolbox>`__ for either Mac OS X or Microsoft Windows.
It is a graphical user interface for running Docker containers. Follow these steps to install 
Kitematic and then download, start, and connect to an instance of CDAP.

#. Download and install the `Docker Toolbox <https://www.docker.com/docker-toolbox>`__ for 
   either Mac OS X or Microsoft Windows.

#. Start Kitematic. On Mac OS X, it will be installed in ``/Applications/Docker/Kitematic``; on 
   Windows, in ``Start Menu > Docker > Kitematic``.
   
#. Once Kitematic has started, search for the **CDAP image** using the search box at the
   top of the window. Then click on the repository menu, circled in red here:
 
     .. image:: ../../_images/kitematic/kitematic-1-searching.png
        :width: 8in
        :align: center

#. Click on the tags button:
 
     .. image:: ../../_images/kitematic/kitematic-2-tags.png
        :width: 4in
        :align: center

#. Select the desired version.
   Note that the tag **latest** is the last version that was put up at Docker Hub, which is not the 
   necessarily the most-current version:
 
     .. image:: ../../_images/kitematic/kitematic-3-select-tag.png
        :width: 4in
        :align: center

#. Close the menu by pressing the ``X`` in the circle. Press "Create" to download and start the CDAP image. 
   When it has started up, you will see in the logs a message that the CDAP UI is listening on port 9999:
 
     .. image:: ../../_images/kitematic/kitematic-4-cdap-started.png
        :width: 8in
        :align: center

#. To connect a web browser for the CDAP UI, you'll need to find the external IP addresses
   and ports that the Docker instance is exposing. The easiest way to do that is click on the
   *Settings* tab, and then the *Ports* tab:
 
     .. image:: ../../_images/kitematic/kitematic-5-links.png
        :width: 8in
        :align: center


#. This shows that the CDAP instance is listening on the internal port ``9999`` within the
   Docker instance, while the Docker instance exposes that port on the external IP address
   and port ``192.168.99.100:32769``. The text in blue is a link; clicking it will open it
   in your system web browser and connect to the CDAP UI:
   
     .. image:: ../../_images/kitematic/kitematic-6-cdap-ui.png
        :width: 8in
        :align: center


.. _docker-command-line:

Docker from a Command Line
==========================

- Docker is available for a variety of platforms. Download and install Docker in your environment by
  following the `platform-specific installation instructions <https://docs.docker.com/engine/installation/>`__
  from `Docker.com <https://docker.com>`__ to verify that Docker is working and has
  started correctly.
  
  If you are not running on Linux, you need to start the Docker Virtual Machine (VM) before you
  can use containers. For example, on Mac OS, use::
  
    $ boot2docker start
    $ boot2docker ip
    
  to determine the Docker VM's IP address. You will need to use that address as the host
  name when either connecting to the CDAP UI or making an HTTP request.
  
  When you run ``boot2docker start``, it will print a message on the screen such as::

    To connect the Docker client to the Docker daemon, please set:
        export DOCKER_HOST=tcp://192.168.59.103:2375
        export DOCKER_CERT_PATH=/Users/.../.boot2docker/certs/boot2docker-vm
        export DOCKER_TLS_VERIFY=1
{'fraction_non_alphanumeric': 0.10438219225851447, 'fraction_numerical': 0.015111007787980937, 'mean_word_length': 3.1365384615384615, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 10, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1090437', 'n_tokens_mistral': 2641, 'n_tokens_neox': 2384, 'n_words': 1092}