Skip to main content
All CollectionsUser ManualSharing and finding published capsules
Exporting capsules and reproducing results on your local machine
Exporting capsules and reproducing results on your local machine

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

Updated over 2 years ago

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


Demo Code Ocean 2022-02-15 at 4.59.05 PM

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. If you have downloaded a published capsule, this document will point to the preserved Docker image in our registry. 

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

  • /metadata has a file called metadata.yml that will look something like this (for an unpublished capsule):

metadata_version: 1
name: Cape Feare
authors:
- name: Sideshow Bob
  affiliations:
  - name: The Krusty the Clown Show
corresponding_contributor:
  name: Sideshow Bob

Published capsules will have all of the information in the corresponding capsule's metadata pane. 

  • 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. Other files may appear if, for instance, you use an additional PPA.

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

FROM registry.codeocean.com/codeocean/r-base:3.4.4-ubuntu16.04

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

ARG DEBIAN_FRONTEND=noninteractive

RUN 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.

A word of caution:

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.
Should you run into any issues, please don't hesitate to reach out to us through intercom or support@codeocean.com.

Further reading:

From Docker's documentation, Get Started, Part 1: Orientation and setup.

Carl Boettiger and Dirk Eddelbuettel, " An Introduction to Rocker: Docker Containers for R."

Did this answer your question?