Exporting capsules and reproducing results on your local machine

Steps for running code as you find it on Code Ocean locally.

Code Ocean allows authors and readers to download an entire compute capsule. Click the Capsule tab in the menu and select Export:

This will prompt a download screen where you can download the environment template, metadata, code, and, optionally, the data. When you unzip this, you will see something like the following (this screenshot comes from a mac):

  • REPRODUCING.md contains specific instructions for how to reproduce the capsule's results locally, with notes on the necessary prerequisites and commands.

  • /code has your capsule's code, and /data has your capsule's data.

  • /metadata has a file called metadata.yml

  • The /environment folder contains, at a minimum, a file called Dockerfile . If you've employed a postInstall script, you will see a postInstall file as well.

Dockerfile is the recipe for rebuilding your capsule's computational environment locally. Each will begin with a line like:

FROM registry.<acmecorp>.codeocean.com/codeocean/r-base:3.4.4-ubuntu18.04

This tells the Dockerfile from where to pull the Docker image. If the environment has been customized further, there will be more commands like:

ARG DEBIAN_FRONTEND=noninteractiveRUN apt-get update \    && apt-get install -y --no-install-recommends \      "curl=7.47.0-1ubuntu2.2" \      "gcc=4:5.3.1-1ubuntu1" \      "libnlopt-dev=2.4.2+dfsg-2" \      "pandoc=1.16.0.2~dfsg-1" \    && rm -rf /var/lib/apt/lists/*

and so on.

Reproducing your results locally is likely to be less user-friendly than reproducing results on Code Ocean. Docker requires some familiarity with the command line.

Last updated