Further instructions with Docker

Please see the below information which essentially bootstraps the Getting Started setup for further functionality.

The instructions in Getting Started and Updating with Docker are intended to provide an environment with the shortest path to being able to get started with the application. Installing with that method has a drawback, in that once the container is exited, any data written to disk is lost.

In order to set up an environment where such operations are available, please see the below.

Enable persistence across executions

Using the docker concept of volumes, any data imported into mbpy or written to disk during an operation will persist across executions.

In the instructions, following the "From the host", instead of this:

docker run -it --rm mbpy_mbpycli

Use the volume option:

docker run -it -v .:/docker --rm mbpy_mbpycli

This adds a -v ("volume") option, telling docker to take the host's current directory (".") and bind it (":) to the container directory (/docker). Please note, however, that the use of "current directory" assumes that you are in the same directory that you cloned into.

A more general-purpose command, then, which you can execute no matter the current working directory, would be to replace the "." with the full path to the mbpy folder. If you followed the instructions for getting started, it's just this:

docker run -it -v ~/src/mbpy:/docker --rm mbpy_mbpycli

Great! So now we can add whatever commands onto the end. However, that is a lot of typing, is there a way to just type mbpy from our host terminal? Yes, yes there is, which is the topic of the next section:

Use an alias on the host

The docker container itself already has an mbpy alias set up so that typing it when connected to the shell in the container executes the application.

Last updated