Skip to content

Latest commit

 

History

History
93 lines (57 loc) · 3.98 KB

DOCKER_EXAMPLE.md

File metadata and controls

93 lines (57 loc) · 3.98 KB

Docker Examples

Below we include two examples for working with images in Docker along with a demonstration video showing the package in action.

Using The RCOBOLDI RStudio Image On DockerHub

The RCOBOLDI Rocker/RStudio image is available on DockerHub. This image is built using dependencies which have been deployed in the Drat repository.

The RCOBOLDI Rocker/Verse image is a complete build using source code cloned from the GitHub repository.

The following is a fully working example based on the Rocker/RStudio image.

From the command line:

docker pull thospfuller/rcoboldi-rockstar-rstudio:[latest or 1.0.3 or some other tag]

then

docker image ls

should show something like this:

REPOSITORY TAG IMAGE ID CREATED SIZE thospfuller/rcoboldi-rockstar-rstudio 1.0.3 3f8c1c269940 37 minutes ago 2.42GB

then

docker run -d -p 8787:8787 -e PASSWORD=password --name rstudio -i -t 3f8c1c269940

From the browser:

The next step is to test this in R so point your browser to http://localhost:8787 and use "rstudio" and "password" to login and then execute the following:

library(RCOBOLDI)
RCOBOLDI::Initialize()
result <- RCOBOLDI::ReadCopyBookAsDataFrame("/home/rstudio/rcoboldi/java/rcoboldi-core/src/test/resources/example1/DTAR020.cbl", "/home/rstudio/rcoboldi/java/rcoboldi-core/src/test/resources/example1/DTAR020.bin", "Fixed Length Binary", "cp037")
head(result)

Building the RCOBOLDI RStudio Docker Image Locally

Step 1.) Build the image (this can take up to 20 minutes).

docker build -t rcoboldi/rocker-rstudio:1.0.1 https://raw.githubusercontent.com/thospfuller/rcoboldi/master/docker/rocker/rstudio/Dockerfile
[some image id]

Build the Docker image from the R COBOL Data Integration package Dockerfile."

Step 2.) Launch a container based on this image.

docker run -d -p 8787:8787 -e PASSWORD=password --name rstudio -i -t [some image id]
[some container id]

Step 3.) Browse to http://localhost:8787 and enter the username & password combination rstudio & password.

The next three steps appear in the video.

Steps 4-7.) From the R CLI execute:

### Step 4.)
library(RCOBOLDI)

### Step 5.)
RCOBOLDI::Initialize()

### Step 6.)
result <- RCOBOLDI::ReadCopyBookAsDataFrame("DTAR020.cbl", "DTAR020.bin", "Fixed Length Binary", "cp037")

### Step 7.)
head(result)

An example of the R COBOL Data Integration Package loading a file with the inputFileStructure set to "Fixed Length Binary" and the font set to "cp037". This should work out-of-the-box with a container built from the rcoboldi:rocker-rstudio image."

YouTube

If you're looking to load COBOL data files into the R Project for Statistical Computing then you came to the right place.

The Dockerfile in this example is based on Rocker / RStudio and will be running locally on port 8787.

Below is a video which demonstrates the R COBOL Data Integration package running in Docker.

Introduction To RCOBOLDI Data Integration Package

See Also