{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Application Hosting on Cat9000 and IOx\n",
    "\n",
    "Exam topics covered:  \n",
    "5.5 Describe how to host an application on a network device (including Catalyst 9000 and Cisco IOx-enabled devices)\n",
    "\n",
    "## Overview\n",
    "Network devices such as the Catalyst 9300 support application hosting by providing an environment where applications can run as Docker containers on the device. This means a network appliance can run any x86 compatible app as a container.  Each container is allocated 1Gbps max of bandwidth, and storage can use the on-board SSD or a USB drive can be added for additional capacity.  \n",
    "\n",
    "### Installation Process\n",
    "1. Create a Dockerfile and docker-compose file for the application\n",
    "\n",
    "2. Export the Docker image as a .tar file:\n",
    "```\n",
    "docker save [image-name] -o [filename].tar\n",
    "```\n",
    "3. Copy the image to the device using FTP/SCP, etc.\n",
    "\n",
    "4. Configure the switch for app hosting\n",
    "```\n",
    "app-hosting appid [app-name]\n",
    "vlan 4000 guest-interface 0\n",
    "  guest-ipaddress 10.10.20.101 netmask 255.255.255.0\n",
    "app-default-gateway 10.10.20.254 guest-interface 0\n",
    "app-resource docker\n",
    "  run-opts \"--restart=unless-stopped -p 5000:5000/tcp\"\n",
    "```\n",
    "5. Install the application and verify  \n",
    "```\n",
    "app-hosting install appid [app-name] package usbflash1:[filename].tar  \n",
    "show app-hosting list  \n",
    "!\n",
    "status=DEPLOYED\n",
    "```\n",
    "6. Activate the application and verify  \n",
    "```\n",
    "app-hosting activate appid [app-name]\n",
    "show app-hosting list\n",
    "!\n",
    "status=ACTIVATED\n",
    "```\n",
    "\n",
    "7. Start the application  \n",
    "```\n",
    "app-hosting start appid [app-name]\n",
    "!\n",
    "status=RUNNING\n",
    "```\n",
    "\n",
    "### Verification\n",
    "\n",
    "```\n",
    "show app-hosting utilization appid [app-name]\n",
    "show app-hosting detail appid [app-name]\n",
    "```\n",
    "\n",
    "### Shutdown\n",
    "```\n",
    "app-hosting stop appid [app-name]\n",
    "app-hosting deactivate [app-id]\n",
    "app-hosting uninstall [app-name]\n",
    "```\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}