Option 2 Using a Docker Container
Option 2 Using a Docker ContainerOption 2. Using a Docker container
In order to run a precompiled version of the CCPP SCM in a container, Docker needs to be available on your machine. Please visit https://www.docker.com to download and install the version compatible with your system. Docker frequently releases updates to the software; it is recommended to apply all available updates. NOTE: In order to install Docker on your machine, you need to have root access privileges. More information about getting started can be found at https://docs.docker.com/get-started and in Section 4.5 of the CCPP SCM User and Technical Guide.
In the first exercise you will use a prebuilt Docker image available on Docker Hub. In subsequent exercises you will use the same image to rebuild your own SCM executable with various modifications.
Using a prebuilt Docker image
A prebuilt Docker image is available on Docker Hub. In order to use this, execute the following from the terminal where Docker is run:
To verify that it exists afterward, run the command:
Proceed to “Set up the Docker image”.
Set up the Docker image
Next, you will set up an output directory so that output generated by the SCM and its scripts within the container can be used outside of the container using the following steps:
- Set up a directory that will be shared between the host machine and the Docker container. When set up correctly, it will contain output generated by the SCM within the container for manipulation by the host machine. For Mac/Linux,
For Windows, you can try to create a directory of your choice to mount to the container, but it may not work or may require more configuration, depending on your particular Docker installation. We have found that Docker volume mounting in Windows can be difficult to set up correctly. One method that worked for us was to create a new directory under our local user space, and specify the volume mount as below.
In addition, with Docker Toolbox, double check that the mounted directory has correct permissions. For example, open VirtualBox, right click on the
running virtual machine, and choose “Settings”. In the dialog that appears, make sure that the directory you’re trying to share shows up in “Shared Folders" (and add it if it does not) and make sure that the “auto-mount" and “permanent" options are checked.
- Set an environment variable to point to the directory that was set up in the previous step.
- To use the SCM in the container interactively, run non-default configurations, create plots, or even develop code, issue the following command:
Note that this command will not actually run the SCM, but will put you within the container space and within the bin directory of the SCM with a pre-compiled executable. At this point, you can run the scripts as described in the following sections.
A couple things to note when using a container:
- The run scripts should be used with the -d option if output is to be shared with the host machine
- Since the container is ephemeral, if you do development you should push your changes to a remote git repository to save them (i.e. a fork on GitHub.com).