A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bhaskarvk/docker below:

bhaskarvk/docker: R Package For Accessing Docker via Docker APIs

docker: An R Package for Docker

The docker R package provides access to the docker API to programmatically control a docker engine from R. The docker engine could be running either locally or remotely. The docker package uses the reticulate R package to invoke the Python SDK for docker. Using the Python SDK allows the docker package to have a very minimal foot-print and yet allow complete docker API access. The package has been tested against docker engine running on Linux and Microsoft Windows and should also work under MacOS.

Controlling a docker engine from withing R can be useful for ...

Release version

install.packages('docker')

OR development version

if(!require(devtools)) {
  install.packages("devtools")
}
devtools::install_github('bhaskarvk/docker')

Before you can use this package you need to have Python 2.x (>=2.7) or Python 3.x (>=3.4) with the docker Python module which provides Python SDK for docker. A simple way to do this is using a virtual environment. virtualenvwrapper makes setting up Python modules quite painless.

Once you have installed Python and setup virtualenvwrapper you need to create a new virtual environment and install the docker Python module in it.

mkvirtualenv --python=/usr/bin/python3 docker
workon docker
pip install docker

# Test the SDK againsts a locally running docker
# You should have a locally running docker for this.
python -c 'import docker; print(docker.from_env().version())'

You should see something like below, provided you had a locally running docker engine.

{'Os': 'linux', 'Arch': 'amd64', 'KernelVersion': '4.10.0-24-generic', 'GitCommit': '02c1d87', 'Version': '17.06.0-ce', 'BuildTime': '2017-06-23T21:19:04.990631145+00:00', 'MinAPIVersion': '1.12', 'GoVersion': 'go1.8.3', 'ApiVersion': '1.30'}
reticulate::use_virtualenv("docker")
library(docker)
client <- docker$from_env()
s <- client$containers$run("alpine", 'echo -n "Hello World!"', remove=TRUE)
print(s$decode("UTF-8"))
#> [1] "Hello World!"

After you have a successful 'Hellow World!' displayed above, you can call every API supported by the Python SDK using reticulate. Please consult the documents for the SDK and the reticulate R package in the links given above.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4