{"_id":"5be5bbb2ffa7a1021c0be8df","project":"54cf411f9d09bb0d00a17a1c","version":{"_id":"54cf411f9d09bb0d00a17a1f","project":"54cf411f9d09bb0d00a17a1c","__v":16,"createdAt":"2015-02-02T09:19:27.656Z","releaseDate":"2015-02-02T09:19:27.656Z","categories":["54cf41209d09bb0d00a17a20","54cfb99bbba1a023008741af","54cfb9a65ff7e617002bbd7f","54cfba03bba1a023008741b6","54cfba0ebba1a023008741b8","54cfba19bba1a023008741b9","54cfba29bba1a023008741bb","54cfba345ff7e617002bbd87","54cfba3ebba1a023008741bc","54cfba473995cf0d0006f6f0","54e371b18ef7552300409bf2","54e37aa5e887c50d005ef629","555a4e9b147f91190092d137","56b0e91802f4bc0d006ce254","5bb4f4e01635b500032b94fd","5c05a785ceb5b80220cf0e93"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"5c05a785ceb5b80220cf0e93","project":"54cf411f9d09bb0d00a17a1c","version":"54cf411f9d09bb0d00a17a1f","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2018-12-03T22:00:37.979Z","from_sync":false,"order":8,"slug":"migrating-to-offline","title":"Migrating to Offline"},"user":"5bac0709475b5d000364fa42","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-11-09T16:54:10.139Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"You can move your existing Cloud9 online workspace to your local desktop or laptop computer and work with it offline from there. \n\nTo do this, we recommend the following approach:\n\n1. Download the folders, files, and data from your Cloud9 online workspace onto your local desktop or laptop computer. \n2. Install and then run [Docker](https://docs.docker.com/engine/docker-overview/) on that same computer. You should be comfortable working with Docker. If you're not, get up to speed with the *Docker Get Started Tutorial*, specifically [Part 1: Orientation and setup](https://docs.docker.com/get-started/) and [Part 2: Containers](https://docs.docker.com/get-started/part2/).\n3. Use Docker to run a Docker [container](https://docs.docker.com/engine/docker-overview/#docker-objects) on that same computer. This container has the settings, packages, apps, and dependencies from your original Cloud9 online workspace. It also has access to the folders, files, and data that you downloaded from your original online workspace. \n4. Use an integrated development environment (IDE) to work with your Cloud9 workspace in the running container. \n\nThe rest of this topic describes this approach in detail. \n\n:exclamation: **The information in this topic is not fully supported by Cloud9 or AWS. Use it at your own risk.** We have not fully tested the following information with all operating systems and IDEs, and can't guarantee it will work in all situations. Be sure to back up your workspace's original folders, files, and data to a separate, secure location so that you can re-create your original workspace, if needed. \n\n:question: If you have questions or need help migrating, go to the [Cloud9 Community](https://community.c9.io/) website or email [support:::at:::c9.io](mailto:support@c9.io).\n\n# Contents\n\n* [Prerequisites](migrating-to-cloud9-offline#section-prerequisites)\n* [Step 1: Download folders, files, and data from your workspace](migrating-to-cloud9-offline#section-step-1-download-folders-files-and-data-from-your-workspace)\n* [Step 2: Install Docker](migrating-to-cloud9-offline#section-step-2-install-docker)\n* [Step 3: Start Docker](migrating-to-cloud9-offline#section-step-3-start-docker)\n* [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container)\n* [Step 5: Use an IDE to work with your workspace offline](migrating-to-cloud9-offline#section-step-5-use-an-ide-to-work-with-your-workspace-offline)\n* [Step 6: Save new workspace changes as you work](migrating-to-cloud9-offline#section-step-6-save-new-workspace-changes-as-you-work)\n* [Cleaning up](migrating-to-cloud9-offline#section-cleaning-up)\n\n# Prerequisites\n\nWe recommend using a local desktop or laptop computer running an operating system that [Docker Community Edition (Docker CE)](https://docs.docker.com/install/overview/) supports. \n\nAt the time of this writing, supported operating systems are:\n\n* **macOS**: OS X El Capitan 10.11 or later.\n* **Windows**: Windows 10.\n* **Linux**:\n  * **Ubuntu**: Xenial 16.04 (LTS) or Trusty 14.04 (LTS).\n  * **Debian**: Stretch 9 (stable), Jessie 8 (LTS), or Wheezy 7.7 (LTS).\n  * **Fedora**: 64-bit version 26 or 27.\n  * **CentOS**: A maintained version of CentOS 7.\n\nThat same computer must have the IDE that you want to use to work with your Cloud9 workspace that is running in Docker.\n\n:information-source: If you're running an older version of a Mac or Windows operating system that Docker CE doesn't support, you can try using [Docker Toolbox](https://docs.docker.com/toolbox/overview/). We link to equivalent Docker Toolbox instructions throughout this topic. However, we don't go into details about them here.\n\n# Step 1: Download folders, files, and data from your workspace\n\nIn your existing Cloud9 online workspace, you might have some combination of folders, files, data in databases, and content in app frameworks (such as WordPress) that you want to continue working with. If you don't have any of these, skip ahead to [Step 2: Install Docker](migrating-to-cloud9-offline#section-step-2-install-docker).\n\nTo get your folders, files, and data out of your workspace and onto your local computer, complete one or more of the following sets of instructions:\n\n* [Downloading Folders and Files to Your Computer](doc:downloading-files-to-your-computer)\n* [Uploading Folders and Files to a Source Code Repository](doc:uploading-files-to-a-source-code-repository) / [Downloading Files from a Source Code Repository](downloading-files-from-a-source-code-repository) \n* [Downloading Data from a Database](doc:downloading-data-from-a-database) \n* [Downloading App Framework Content](doc:downloading-app-framework-content)\n\nWe recommend that you create a single, blank directory on your local computer and put all of your workspace's folders, files, and data into it. In a later step, you connect Docker to this directory. For example, this topic uses `mkdir -p ~/c9/downloaded-files/`. (For Windows, `~` is available through utilities such as [PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and [Git Bash for Windows](https://gitforwindows.org/). Or you can use something like `mkdir <drive>:\\Users\\<user_name>\\c9\\downloaded-files\\`.)\n\n:information-source: The preceding topics instruct you to return to the migration checklist for moving to AWS Cloud9 when you're done. Because you're not migrating to AWS Cloud9, you can safely ignore those instructions. Instead, when you're done with those topics, return to this one.\n\n# Step 2: Install Docker\n\nIn this step, you install [Docker Community Edition (Docker CE)](https://docs.docker.com/install/overview/) on your local computer. If you already have Docker installed, skip ahead to [Step 3: Start Docker](migrating-to-cloud9-offline#section-step-3-start-docker). \n\nTo check whether Docker is installed, run the command `docker --version` from your operating system's terminal or command prompt. If you get an error message, see the following procedure, \"To install Docker CE\". Otherwise, if the Docker version number is displayed, skip ahead to [Step 3: Start Docker](migrating-to-cloud9-offline#section-step-3-start-docker).\n\nTo install Docker CE, see the following:\n\n* **macOS**: [Install Docker for Mac](https://docs.docker.com/v17.12/docker-for-mac/install/).\n* **Windows**: [Install Docker for Windows](https://docs.docker.com/v17.12/docker-for-windows/install/).\n* **Linux**:\n  * **Ubuntu**: [Get Docker CE for Ubuntu](https://docs.docker.com/v17.12/install/linux/docker-ce/ubuntu/).\n  * **Debian**: [Get Docker CE for Debian](https://docs.docker.com/v17.12/install/linux/docker-ce/debian/).\n  * **Fedora**: [Get Docker CE for Fedora](https://docs.docker.com/v17.12/install/linux/docker-ce/fedora/).\n  * **CentOS**: [Get Docker CE for CentOS](https://docs.docker.com/v17.12/install/linux/docker-ce/centos/).\n\n:information-source: If you must use Docker Toolbox instead of Docker CE, see [Install Docker Toolbox on macOS](https://docs.docker.com/toolbox/toolbox_install_mac/) or [Install Docker Toolbox on Windows](https://docs.docker.com/toolbox/toolbox_install_windows/), and then skip ahead to [Step 3: Start Docker](migrating-to-cloud9-offline#section-step-3-start-docker).\n\n# Step 3: Start Docker\n\nIn this step, you start the Docker process or app. If Docker is already running, skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container). \n\n:information-source: If you're using Docker Toolbox instead of Docker CE, see [Verify your installation for Mac](https://docs.docker.com/toolbox/toolbox_install_mac/#step-3-verify-your-installation) or [Verify your installation for Windows](https://docs.docker.com/toolbox/toolbox_install_windows/#step-3-verify-your-installation), and then skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container).\n\nTo check whether Docker is running:\n\n* **macOS**: Check whether the whale in the status bar is in a steady state (in other words, the blocks on top of the whale aren't moving). This indicates that Docker is running. If the whale is in a steady state, skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container). If the whale isn't in the status bar, see the following procedure, \"To start Docker\".\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/aef59f7-whale-in-menu-bar.png\",\n        \"whale-in-menu-bar.png\",\n        394,\n        43,\n        \"#464448\"\n      ]\n    }\n  ]\n}\n[/block]\n* **Windows**: Check whether the whale in the taskbar is in a steady state (in other words, the blocks on top of the whale aren't moving). This indicates that Docker is running. If the whale is in a steady state, skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container).  If the whale isn't in the taskbar, see the following procedure, \"To start Docker\". \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/94624f8-whale-taskbar-circle.png\",\n        \"whale-taskbar-circle.png\",\n        256,\n        47,\n        \"#0e0b0a\"\n      ]\n    }\n  ]\n}\n[/block]\n* **Linux**: Run the command `sudo systemctl status docker` or `sudo service docker status`, depending on your operating system. \n\n   If the service is running, skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container).\n\n   If the service isn't running, see the following procedure, \"To start Docker\".\n\nTo start Docker: \n\n* **macOS**: Double-click **Docker.app** in your **Applications** folder. Then see the previous procedure, \"To check whether Docker is running\".\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/50849de-docker-app-in-apps.png\",\n        \"docker-app-in-apps.png\",\n        886,\n        198,\n        \"#c4e0e7\"\n      ]\n    }\n  ]\n}\n[/block]\n* **Windows**: Choose **Start**, search for `Docker`, and choose the **Docker for Windows** app in the search results. Then see the previous procedure, \"To check whether Docker is running\".\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/b698155-docker-app-search.png\",\n        \"docker-app-search.png\",\n        593,\n        682,\n        \"#262527\"\n      ]\n    }\n  ]\n}\n[/block]\n* For Linux, run the command `sudo systemctl start docker` or `sudo service docker start`, depending on your operating system. Then see the previous procedure, \"To check whether Docker is running\".\n\n# Step 4: Run the container\n\nIn this step, you have Docker run a container that has the settings, packages, apps, and dependencies, based on your original Cloud9 online workspace. This container also connects to the directory that contains your downloaded content.\n\n1. Get the base image ID for your original Cloud9 online workspace. To get this base image ID, look in the Cloud9 console at either your workspace tile's caption on your Cloud9 dashboard's **Workspaces** page, or the tile's caption in the **Choose a template** section of the **Create a new workspace** page.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/cf2ad58-ide-workspace-tile-caption.png\",\n        \"ide-workspace-tile-caption.png\",\n        614,\n        620,\n        \"#eeeeed\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/cf2bd61-console-choose-template.png\",\n        \"console-choose-template.png\",\n        830,\n        274,\n        \"#d8d8d6\"\n      ]\n    }\n  ]\n}\n[/block]\n2. Once you have the caption from the workspace tile or the workspace template tile, use the following table to look up the base image ID.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Workspace tile caption\",\n    \"h-1\": \"Workspace template tile caption\",\n    \"h-2\": \"Base image ID\",\n    \"0-0\": \"php workspace\",\n    \"0-1\": \"HTML5\",\n    \"1-0\": \"nodejs workspace\",\n    \"1-1\": \"Node.js\",\n    \"2-0\": \"php workspace\",\n    \"2-1\": \"PHP, Apache, & MySQL\",\n    \"3-0\": \"python workspace\",\n    \"3-1\": \"Python\",\n    \"4-0\": \"python workspace\",\n    \"4-1\": \"Django\",\n    \"5-0\": \"ruby workspace\",\n    \"5-1\": \"Ruby\",\n    \"6-0\": \"cpp workspace\",\n    \"6-1\": \"C++\",\n    \"7-0\": \"wordpress workspace\",\n    \"7-1\": \"Wordpress\",\n    \"8-0\": \"railstutorial workspace\",\n    \"8-1\": \"Rails Tutorial\",\n    \"9-0\": \"<blank>\",\n    \"9-1\": \"Blank\",\n    \"10-0\": \"cs50 workspace\",\n    \"10-1\": \"Harvard's CS50\",\n    \"10-2\": \"`cs50/ide` - Note that this image includes a special version of Cloud9 Core with CS50-specific plugins. For more information, see [CS50 IDE Offline](https://cs50.readthedocs.io/ide/offline/).\",\n    \"0-2\": \"`cloud9/ws-html5`\",\n    \"1-2\": \"`cloud9/ws-nodejs`\",\n    \"2-2\": \"`cloud9/ws-php`\",\n    \"3-2\": \"`cloud9/ws-python-plain`\",\n    \"4-2\": \"`cloud9/ws-python`\",\n    \"5-2\": \"`cloud9/ws-ruby`\",\n    \"6-2\": \"`cloud9/ws-cpp`\",\n    \"7-2\": \"`cloud9/ws-wordpress`\",\n    \"9-2\": \"`cloud9/ws-default`\",\n    \"8-2\": \"`cloud9/ws-ruby`\"\n  },\n  \"cols\": 3,\n  \"rows\": 11\n}\n[/block]\n3. From a terminal or command prompt on your local computer, run the following command to run the container, substituting `<base_image_id>` for the base image ID that you just noted, for example `cloud9/ws-default`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"docker run --privileged -e \\\"IP=127.0.0.1\\\" -e \\\"PORT=8080\\\" --name myc9ws --mount type=bind,source=~/c9/downloaded-files/,target=/home/ubuntu/workspace/ -d -t -p 5050:5050 -p 8080-8082:8080-8082 <base_image_id>\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIn the preceding command: \n\n* `--privileged` gives the container permission to do almost everything that the host operating system can do.\n* `-e` sets simple environment variables in the container, in this case the IP address and port.\n* `--name` is a name for the image, in this case, `myc9ws`. \n* `--mount` makes a directory available to the container. `source` is the path to the directory on the host operating system (for example, `~/c9/downloaded-files/` or `<drive>:\\Users\\<user_name>\\c9\\downloaded-files\\` for Windows), and `target` is the path in the container that you can use to refer to that same directory (for example, `/home/ubuntu/workspace/`).\n* `-d` means to run the container in the background.\n* `-t` means to run the container with a pseudo terminal.\n* `-p` connects ports in the container to ports on the host operating system. If port 5050 is already in use on your local computer, change it to a different port.\n* `<base_image_id>` is the base image ID to use, which you noted previously (for example `cloud9/ws-default`). Docker pulls the base image down to your local computer if it doesn't already exist there. Note that pulling down a base image for the first time might take several minutes.\n\n:information-source: On Linux, you might need to add `sudo` before `docker`, both here and throughout the rest of this topic. To get around this, see [Manage Docker as a non-root user](https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user).\n\nTo confirm that the container is indeed running, run the command `docker ps`. If it's running, you'll see a container with a **NAMES** value of **myc9ws** and a **STATUS** of **Up** in the list of containers. \n\nIf it isn't running, try running the command `docker start myc9ws`, and then run `docker ps` again. \n\nTo see a list of all available containers, regardless of status, run `docker ps -a`.\n\n# Step 5: Use an IDE to work with your workspace offline\n\nSome IDEs provide features or techniques for working with code in running Docker containers. See the following resources to explore some possibilities. \n\n* Cloud9 Core: see [Using Cloud9 Core](doc:using-cloud9-core).\n* Visual Studio Code: see the [Docker WorkSpace](https://marketplace.visualstudio.com/items?itemName=tiibun.vscode-docker-ws) extension.\n\nNote that we have not fully tested these resources with all operating systems, and can't guarantee they will work in all situations.\n\n# Step 6: Save new workspace changes as you work\n\nIf you stop a container, or if the host operating system stops the container for some other reason,  any uncommitted changes that you made to that container might be lost. To save your changes as you work, one approach is to commit those changes to a new container.\n\nTo commit your changes to a new container, run the following command.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"docker commit <existing_container_name> <new_base_image_id>\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIn the preceding command: \n\n* `<existing_container_name>` is the name of the container that was started, for example `myc9ws`.\n* `<new_base_image_id>` is an ID you choose for the new base image, for example, `cloud9/ws-default:YYYY-MM-DD-VV`; where `YYYY-MM-DD` is the current year, month, and day, and `-VV` is some incremental version for that day (for example, `-01`).\n\nTo run a new container based on this new base image, run the following command.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"docker run --privileged -e \\\"IP=127.0.0.1\\\" -e \\\"PORT=8080\\\" --name <new_container_name> --mount type=bind,source=~/c9/downloaded-files/target=/home/ubuntu/workspace/ -d -t -p 5050:5050 -p 8080-8082:8080-8082 <new_base_image_id>\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIn the preceding command: \n\n* `<new_container_name>` is a name you choose for this new container, for example, `myc9ws-YYYY-MM-DD-VV`.\n* `<new_base_image_id>` is the ID of the new base image that you just created, for example, `cloud9/ws-default:YYYY-MM-DD-VV`.\n* If port 5050 is already in use on your local computer, change it to a different port.\n\n# Cleaning up\n\nTo delete Docker and all of its resources from your local computer, follow the steps in this section.\n\n## Step 1: Stop running Docker containers\n\nTo stop all running Docker containers, run the command `docker stop $(docker ps -a -q)`. Note that to run this command in Windows, you should use a utility such as PowerShell or Git Bash for Windows.\n\nTo stop a specific running Docker container, run the command `docker stop <container_name>`, where `<container_name>` is the name of the container to stop. \n\nTo see a list of running Docker containers, run the command `docker ps`.\n\n## Step 2: Delete Docker containers\n\nTo delete all Docker containers, run the command `docker rm -f $(docker ps -a -q)`. Note that to run this command in Windows, you should use a utility such as PowerShell or Git Bash for Windows.\n\nTo delete a specific Docker container, run the command `docker rm -f <container_name>`, where `<container_name>` is the name of the container to delete. \n\nTo see a list of Docker containers, run the command `docker ps -a`.\n\n## Step 3: Delete Docker images\n\nTo delete all Docker images, run the command `docker rmi -f $(docker images -q)`. Note that to run this command in Windows, you should use a utility such as PowerShell or Git Bash for Windows.\n\nTo delete a specific Docker image, run the command `docker rmi -f <image_name>`, where `<image_name>` is the name of the image to delete. \n\nTo see a list of Docker images, run the command `docker image ls`.\n\n## Step 4: Stop Docker\n\n* **macOS**: Click the whale in the status bar, and then choose **Quit Docker**.\n* **Windows**: Right-click the whale in the taskbar, and then choose **Quit Docker Desktop**.\n* **Linux**: Run the command `sudo systemctl stop docker` or `sudo service docker stop`, depending on your operating system.\n\n## Step 5: Uninstall Docker\n\n* **macOS**: If the whale is in the status bar, choose the whale, and then choose **Uninstall**. If the whale isn't in the status bar, run the command `run: <DockerforMacPath> --uninstall`, for example, `/Applications/Docker.app/Contents/MacOS/Docker --uninstall`.\n* **Windows**: Use **Add or remove programs** to uninstall **Docker Desktop**.\n* **Linux**:\n  * **Ubuntu or Debian**: Run the command `sudo apt-get purge docker-ce`.\n  * **Fedora**: Run the command `sudo dnf remove docker-ce`.\n  * **CentOS**: Run the command `sudo yum remove docker-ce`.\n\n:information-source: If you're using Docker Toolbox instead of Docker CE, see [How to uninstall Toolbox for Mac](https://docs.docker.com/toolbox/toolbox_install_mac/#how-to-uninstall-toolbox) or [How to uninstall Toolbox for Windows](https://docs.docker.com/toolbox/toolbox_install_windows/#how-to-uninstall-toolbox).","excerpt":"","slug":"migrating-to-cloud9-offline","type":"basic","title":"Migrating a Cloud9 Workspace to Offline"}

Migrating a Cloud9 Workspace to Offline


You can move your existing Cloud9 online workspace to your local desktop or laptop computer and work with it offline from there. To do this, we recommend the following approach: 1. Download the folders, files, and data from your Cloud9 online workspace onto your local desktop or laptop computer. 2. Install and then run [Docker](https://docs.docker.com/engine/docker-overview/) on that same computer. You should be comfortable working with Docker. If you're not, get up to speed with the *Docker Get Started Tutorial*, specifically [Part 1: Orientation and setup](https://docs.docker.com/get-started/) and [Part 2: Containers](https://docs.docker.com/get-started/part2/). 3. Use Docker to run a Docker [container](https://docs.docker.com/engine/docker-overview/#docker-objects) on that same computer. This container has the settings, packages, apps, and dependencies from your original Cloud9 online workspace. It also has access to the folders, files, and data that you downloaded from your original online workspace. 4. Use an integrated development environment (IDE) to work with your Cloud9 workspace in the running container. The rest of this topic describes this approach in detail. :exclamation: **The information in this topic is not fully supported by Cloud9 or AWS. Use it at your own risk.** We have not fully tested the following information with all operating systems and IDEs, and can't guarantee it will work in all situations. Be sure to back up your workspace's original folders, files, and data to a separate, secure location so that you can re-create your original workspace, if needed. :question: If you have questions or need help migrating, go to the [Cloud9 Community](https://community.c9.io/) website or email [support@c9.io](mailto:support@c9.io). # Contents * [Prerequisites](migrating-to-cloud9-offline#section-prerequisites) * [Step 1: Download folders, files, and data from your workspace](migrating-to-cloud9-offline#section-step-1-download-folders-files-and-data-from-your-workspace) * [Step 2: Install Docker](migrating-to-cloud9-offline#section-step-2-install-docker) * [Step 3: Start Docker](migrating-to-cloud9-offline#section-step-3-start-docker) * [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container) * [Step 5: Use an IDE to work with your workspace offline](migrating-to-cloud9-offline#section-step-5-use-an-ide-to-work-with-your-workspace-offline) * [Step 6: Save new workspace changes as you work](migrating-to-cloud9-offline#section-step-6-save-new-workspace-changes-as-you-work) * [Cleaning up](migrating-to-cloud9-offline#section-cleaning-up) # Prerequisites We recommend using a local desktop or laptop computer running an operating system that [Docker Community Edition (Docker CE)](https://docs.docker.com/install/overview/) supports. At the time of this writing, supported operating systems are: * **macOS**: OS X El Capitan 10.11 or later. * **Windows**: Windows 10. * **Linux**: * **Ubuntu**: Xenial 16.04 (LTS) or Trusty 14.04 (LTS). * **Debian**: Stretch 9 (stable), Jessie 8 (LTS), or Wheezy 7.7 (LTS). * **Fedora**: 64-bit version 26 or 27. * **CentOS**: A maintained version of CentOS 7. That same computer must have the IDE that you want to use to work with your Cloud9 workspace that is running in Docker. :information-source: If you're running an older version of a Mac or Windows operating system that Docker CE doesn't support, you can try using [Docker Toolbox](https://docs.docker.com/toolbox/overview/). We link to equivalent Docker Toolbox instructions throughout this topic. However, we don't go into details about them here. # Step 1: Download folders, files, and data from your workspace In your existing Cloud9 online workspace, you might have some combination of folders, files, data in databases, and content in app frameworks (such as WordPress) that you want to continue working with. If you don't have any of these, skip ahead to [Step 2: Install Docker](migrating-to-cloud9-offline#section-step-2-install-docker). To get your folders, files, and data out of your workspace and onto your local computer, complete one or more of the following sets of instructions: * [Downloading Folders and Files to Your Computer](doc:downloading-files-to-your-computer) * [Uploading Folders and Files to a Source Code Repository](doc:uploading-files-to-a-source-code-repository) / [Downloading Files from a Source Code Repository](downloading-files-from-a-source-code-repository) * [Downloading Data from a Database](doc:downloading-data-from-a-database) * [Downloading App Framework Content](doc:downloading-app-framework-content) We recommend that you create a single, blank directory on your local computer and put all of your workspace's folders, files, and data into it. In a later step, you connect Docker to this directory. For example, this topic uses `mkdir -p ~/c9/downloaded-files/`. (For Windows, `~` is available through utilities such as [PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and [Git Bash for Windows](https://gitforwindows.org/). Or you can use something like `mkdir <drive>:\Users\<user_name>\c9\downloaded-files\`.) :information-source: The preceding topics instruct you to return to the migration checklist for moving to AWS Cloud9 when you're done. Because you're not migrating to AWS Cloud9, you can safely ignore those instructions. Instead, when you're done with those topics, return to this one. # Step 2: Install Docker In this step, you install [Docker Community Edition (Docker CE)](https://docs.docker.com/install/overview/) on your local computer. If you already have Docker installed, skip ahead to [Step 3: Start Docker](migrating-to-cloud9-offline#section-step-3-start-docker). To check whether Docker is installed, run the command `docker --version` from your operating system's terminal or command prompt. If you get an error message, see the following procedure, "To install Docker CE". Otherwise, if the Docker version number is displayed, skip ahead to [Step 3: Start Docker](migrating-to-cloud9-offline#section-step-3-start-docker). To install Docker CE, see the following: * **macOS**: [Install Docker for Mac](https://docs.docker.com/v17.12/docker-for-mac/install/). * **Windows**: [Install Docker for Windows](https://docs.docker.com/v17.12/docker-for-windows/install/). * **Linux**: * **Ubuntu**: [Get Docker CE for Ubuntu](https://docs.docker.com/v17.12/install/linux/docker-ce/ubuntu/). * **Debian**: [Get Docker CE for Debian](https://docs.docker.com/v17.12/install/linux/docker-ce/debian/). * **Fedora**: [Get Docker CE for Fedora](https://docs.docker.com/v17.12/install/linux/docker-ce/fedora/). * **CentOS**: [Get Docker CE for CentOS](https://docs.docker.com/v17.12/install/linux/docker-ce/centos/). :information-source: If you must use Docker Toolbox instead of Docker CE, see [Install Docker Toolbox on macOS](https://docs.docker.com/toolbox/toolbox_install_mac/) or [Install Docker Toolbox on Windows](https://docs.docker.com/toolbox/toolbox_install_windows/), and then skip ahead to [Step 3: Start Docker](migrating-to-cloud9-offline#section-step-3-start-docker). # Step 3: Start Docker In this step, you start the Docker process or app. If Docker is already running, skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container). :information-source: If you're using Docker Toolbox instead of Docker CE, see [Verify your installation for Mac](https://docs.docker.com/toolbox/toolbox_install_mac/#step-3-verify-your-installation) or [Verify your installation for Windows](https://docs.docker.com/toolbox/toolbox_install_windows/#step-3-verify-your-installation), and then skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container). To check whether Docker is running: * **macOS**: Check whether the whale in the status bar is in a steady state (in other words, the blocks on top of the whale aren't moving). This indicates that Docker is running. If the whale is in a steady state, skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container). If the whale isn't in the status bar, see the following procedure, "To start Docker". [block:image] { "images": [ { "image": [ "https://files.readme.io/aef59f7-whale-in-menu-bar.png", "whale-in-menu-bar.png", 394, 43, "#464448" ] } ] } [/block] * **Windows**: Check whether the whale in the taskbar is in a steady state (in other words, the blocks on top of the whale aren't moving). This indicates that Docker is running. If the whale is in a steady state, skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container). If the whale isn't in the taskbar, see the following procedure, "To start Docker". [block:image] { "images": [ { "image": [ "https://files.readme.io/94624f8-whale-taskbar-circle.png", "whale-taskbar-circle.png", 256, 47, "#0e0b0a" ] } ] } [/block] * **Linux**: Run the command `sudo systemctl status docker` or `sudo service docker status`, depending on your operating system. If the service is running, skip ahead to [Step 4: Run the container](migrating-to-cloud9-offline#section-step-4-run-the-container). If the service isn't running, see the following procedure, "To start Docker". To start Docker: * **macOS**: Double-click **Docker.app** in your **Applications** folder. Then see the previous procedure, "To check whether Docker is running". [block:image] { "images": [ { "image": [ "https://files.readme.io/50849de-docker-app-in-apps.png", "docker-app-in-apps.png", 886, 198, "#c4e0e7" ] } ] } [/block] * **Windows**: Choose **Start**, search for `Docker`, and choose the **Docker for Windows** app in the search results. Then see the previous procedure, "To check whether Docker is running". [block:image] { "images": [ { "image": [ "https://files.readme.io/b698155-docker-app-search.png", "docker-app-search.png", 593, 682, "#262527" ] } ] } [/block] * For Linux, run the command `sudo systemctl start docker` or `sudo service docker start`, depending on your operating system. Then see the previous procedure, "To check whether Docker is running". # Step 4: Run the container In this step, you have Docker run a container that has the settings, packages, apps, and dependencies, based on your original Cloud9 online workspace. This container also connects to the directory that contains your downloaded content. 1. Get the base image ID for your original Cloud9 online workspace. To get this base image ID, look in the Cloud9 console at either your workspace tile's caption on your Cloud9 dashboard's **Workspaces** page, or the tile's caption in the **Choose a template** section of the **Create a new workspace** page. [block:image] { "images": [ { "image": [ "https://files.readme.io/cf2ad58-ide-workspace-tile-caption.png", "ide-workspace-tile-caption.png", 614, 620, "#eeeeed" ] } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/cf2bd61-console-choose-template.png", "console-choose-template.png", 830, 274, "#d8d8d6" ] } ] } [/block] 2. Once you have the caption from the workspace tile or the workspace template tile, use the following table to look up the base image ID. [block:parameters] { "data": { "h-0": "Workspace tile caption", "h-1": "Workspace template tile caption", "h-2": "Base image ID", "0-0": "php workspace", "0-1": "HTML5", "1-0": "nodejs workspace", "1-1": "Node.js", "2-0": "php workspace", "2-1": "PHP, Apache, & MySQL", "3-0": "python workspace", "3-1": "Python", "4-0": "python workspace", "4-1": "Django", "5-0": "ruby workspace", "5-1": "Ruby", "6-0": "cpp workspace", "6-1": "C++", "7-0": "wordpress workspace", "7-1": "Wordpress", "8-0": "railstutorial workspace", "8-1": "Rails Tutorial", "9-0": "<blank>", "9-1": "Blank", "10-0": "cs50 workspace", "10-1": "Harvard's CS50", "10-2": "`cs50/ide` - Note that this image includes a special version of Cloud9 Core with CS50-specific plugins. For more information, see [CS50 IDE Offline](https://cs50.readthedocs.io/ide/offline/).", "0-2": "`cloud9/ws-html5`", "1-2": "`cloud9/ws-nodejs`", "2-2": "`cloud9/ws-php`", "3-2": "`cloud9/ws-python-plain`", "4-2": "`cloud9/ws-python`", "5-2": "`cloud9/ws-ruby`", "6-2": "`cloud9/ws-cpp`", "7-2": "`cloud9/ws-wordpress`", "9-2": "`cloud9/ws-default`", "8-2": "`cloud9/ws-ruby`" }, "cols": 3, "rows": 11 } [/block] 3. From a terminal or command prompt on your local computer, run the following command to run the container, substituting `<base_image_id>` for the base image ID that you just noted, for example `cloud9/ws-default`. [block:code] { "codes": [ { "code": "docker run --privileged -e \"IP=127.0.0.1\" -e \"PORT=8080\" --name myc9ws --mount type=bind,source=~/c9/downloaded-files/,target=/home/ubuntu/workspace/ -d -t -p 5050:5050 -p 8080-8082:8080-8082 <base_image_id>", "language": "shell" } ] } [/block] In the preceding command: * `--privileged` gives the container permission to do almost everything that the host operating system can do. * `-e` sets simple environment variables in the container, in this case the IP address and port. * `--name` is a name for the image, in this case, `myc9ws`. * `--mount` makes a directory available to the container. `source` is the path to the directory on the host operating system (for example, `~/c9/downloaded-files/` or `<drive>:\Users\<user_name>\c9\downloaded-files\` for Windows), and `target` is the path in the container that you can use to refer to that same directory (for example, `/home/ubuntu/workspace/`). * `-d` means to run the container in the background. * `-t` means to run the container with a pseudo terminal. * `-p` connects ports in the container to ports on the host operating system. If port 5050 is already in use on your local computer, change it to a different port. * `<base_image_id>` is the base image ID to use, which you noted previously (for example `cloud9/ws-default`). Docker pulls the base image down to your local computer if it doesn't already exist there. Note that pulling down a base image for the first time might take several minutes. :information-source: On Linux, you might need to add `sudo` before `docker`, both here and throughout the rest of this topic. To get around this, see [Manage Docker as a non-root user](https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user). To confirm that the container is indeed running, run the command `docker ps`. If it's running, you'll see a container with a **NAMES** value of **myc9ws** and a **STATUS** of **Up** in the list of containers. If it isn't running, try running the command `docker start myc9ws`, and then run `docker ps` again. To see a list of all available containers, regardless of status, run `docker ps -a`. # Step 5: Use an IDE to work with your workspace offline Some IDEs provide features or techniques for working with code in running Docker containers. See the following resources to explore some possibilities. * Cloud9 Core: see [Using Cloud9 Core](doc:using-cloud9-core). * Visual Studio Code: see the [Docker WorkSpace](https://marketplace.visualstudio.com/items?itemName=tiibun.vscode-docker-ws) extension. Note that we have not fully tested these resources with all operating systems, and can't guarantee they will work in all situations. # Step 6: Save new workspace changes as you work If you stop a container, or if the host operating system stops the container for some other reason, any uncommitted changes that you made to that container might be lost. To save your changes as you work, one approach is to commit those changes to a new container. To commit your changes to a new container, run the following command. [block:code] { "codes": [ { "code": "docker commit <existing_container_name> <new_base_image_id>", "language": "shell" } ] } [/block] In the preceding command: * `<existing_container_name>` is the name of the container that was started, for example `myc9ws`. * `<new_base_image_id>` is an ID you choose for the new base image, for example, `cloud9/ws-default:YYYY-MM-DD-VV`; where `YYYY-MM-DD` is the current year, month, and day, and `-VV` is some incremental version for that day (for example, `-01`). To run a new container based on this new base image, run the following command. [block:code] { "codes": [ { "code": "docker run --privileged -e \"IP=127.0.0.1\" -e \"PORT=8080\" --name <new_container_name> --mount type=bind,source=~/c9/downloaded-files/target=/home/ubuntu/workspace/ -d -t -p 5050:5050 -p 8080-8082:8080-8082 <new_base_image_id>", "language": "shell" } ] } [/block] In the preceding command: * `<new_container_name>` is a name you choose for this new container, for example, `myc9ws-YYYY-MM-DD-VV`. * `<new_base_image_id>` is the ID of the new base image that you just created, for example, `cloud9/ws-default:YYYY-MM-DD-VV`. * If port 5050 is already in use on your local computer, change it to a different port. # Cleaning up To delete Docker and all of its resources from your local computer, follow the steps in this section. ## Step 1: Stop running Docker containers To stop all running Docker containers, run the command `docker stop $(docker ps -a -q)`. Note that to run this command in Windows, you should use a utility such as PowerShell or Git Bash for Windows. To stop a specific running Docker container, run the command `docker stop <container_name>`, where `<container_name>` is the name of the container to stop. To see a list of running Docker containers, run the command `docker ps`. ## Step 2: Delete Docker containers To delete all Docker containers, run the command `docker rm -f $(docker ps -a -q)`. Note that to run this command in Windows, you should use a utility such as PowerShell or Git Bash for Windows. To delete a specific Docker container, run the command `docker rm -f <container_name>`, where `<container_name>` is the name of the container to delete. To see a list of Docker containers, run the command `docker ps -a`. ## Step 3: Delete Docker images To delete all Docker images, run the command `docker rmi -f $(docker images -q)`. Note that to run this command in Windows, you should use a utility such as PowerShell or Git Bash for Windows. To delete a specific Docker image, run the command `docker rmi -f <image_name>`, where `<image_name>` is the name of the image to delete. To see a list of Docker images, run the command `docker image ls`. ## Step 4: Stop Docker * **macOS**: Click the whale in the status bar, and then choose **Quit Docker**. * **Windows**: Right-click the whale in the taskbar, and then choose **Quit Docker Desktop**. * **Linux**: Run the command `sudo systemctl stop docker` or `sudo service docker stop`, depending on your operating system. ## Step 5: Uninstall Docker * **macOS**: If the whale is in the status bar, choose the whale, and then choose **Uninstall**. If the whale isn't in the status bar, run the command `run: <DockerforMacPath> --uninstall`, for example, `/Applications/Docker.app/Contents/MacOS/Docker --uninstall`. * **Windows**: Use **Add or remove programs** to uninstall **Docker Desktop**. * **Linux**: * **Ubuntu or Debian**: Run the command `sudo apt-get purge docker-ce`. * **Fedora**: Run the command `sudo dnf remove docker-ce`. * **CentOS**: Run the command `sudo yum remove docker-ce`. :information-source: If you're using Docker Toolbox instead of Docker CE, see [How to uninstall Toolbox for Mac](https://docs.docker.com/toolbox/toolbox_install_mac/#how-to-uninstall-toolbox) or [How to uninstall Toolbox for Windows](https://docs.docker.com/toolbox/toolbox_install_windows/#how-to-uninstall-toolbox).