https://github.com/cboettig/dockermachine
Simple wrapper around docker-machine tool for creating and managing cloud instances across many providers
https://github.com/cboettig/dockermachine
Last synced: 26 days ago
JSON representation
Simple wrapper around docker-machine tool for creating and managing cloud instances across many providers
- Host: GitHub
- URL: https://github.com/cboettig/dockermachine
- Owner: cboettig
- License: gpl-3.0
- Created: 2017-09-05T00:31:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-05T02:11:48.000Z (over 7 years ago)
- Last Synced: 2024-08-13T07:14:04.226Z (8 months ago)
- Language: R
- Size: 37.1 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - cboettig/dockermachine - Simple wrapper around docker-machine tool for creating and managing cloud instances across many providers (R)
README
---
output: github_document
---```{r, echo = FALSE}
knitr::opts_chunk$set(
message = TRUE,
collapse = TRUE,
comment = ""
)
```# dockermachine
The goal of dockermachine is to provide a convenient interface to `docker-machine` from the R command line. This will allow R users to easily create, control, and destroy cloud instances across a wide variety of providers.
## Installation
You can install dockermachine from github with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("cboettig/dockermachine")
```Once you have installed the R package, use the helper function `install_machine()` to install the latest version of `docker-machine` on your platform, if you have not already installed it some other way:
```{r}
library("dockermachine")
install_machine()
```The sister function `update_machine()` can be used to get a more recent version of `docker_machine()`.
## Getting started
To experiment with `docker-machine`, locally, we recommend installing VirtualBox for your platform and testing out the commands using the `virtualbox` driver.
```{r example}
machine_create("virtualbox")
```This may take up to a few minutes to get your first machine created. By default, this creates a machine named `machine`. You can change this name (e.g. when working with many remote machines through the same client) by passing a different name to the `name` string of most any `machine_*()` command.
Once our machine is up and running, we can list all machines:
```{r}
machine_ls()
```We are also ready now to use the `harbor` R package (or any system commands to the `docker` engine) to deploy custom R images and run R commands on the remote machines.
Use the command `machine_scp` to copy data to your local computer before destroying the remote machine, or push your results to the cloud using your preferred platform such as GitHub, Amazon S3, Google Cloud Storage, or DropBox (all accessible through the R command line with the appropriate additional packages.)
```{r eval=FALSE}
file.create("file.txt")
machine_scp("file.txt", "machine:~/filecopy.txt")
machine_scp("machine:~/filecopy.txt", ".")
```When we're all done, we can stop and remove the machine.
```{r}
machine_stop()
machine_rm()
```This step is crucial to avoid continuing to accumulate charges from a cloud provider. By combining these commands with commands to `harbor` to run code on a remote machine, this allows a user to create R scripts which can deploy long-running instances remotely and shut them down when they are finished.
Once you comfortable creating machines, controlling those machines with docker (see the `harbor` package by Winston Chang), and terminating those machines, then consider trying out one of the remote providers using your Amazon EC2, Google Cloud, Digital Ocean, Azure, openstack, or other credentials.