Getting Started using Docker

Installing mbpy

Getting started with Docker

Download Docker and ensure it's running on your machine.

Install with Docker

We need to get the mbpy command in our terminal. First, this command only needs to run once:

cd mbpy
docker compose up --build

If you are new to docker, that command will build the image and make the container accessible through a default name, which in this case is mbpy_mbpycli. It is using the docker files in the codebase to determine all the settings.

If successful, the terminal will output the version number.

Executing with Docker

From inside the container:

Once the docker image has been built you have some choices on how to actually execute mbpy. The sure-fire way is to connect to the docker container, and run commands directly from within the container. This is a good getting-started method to explore.

You can do that with this command:

docker run -it --entrypoint bash --rm mbpy_mbpycli

There, you can simply use the mbpy command line in the container itself.

For example, mbpy import students and then mbpy extract from-db --table students chain info.To exit, type exit. Note that with this method, the import data will not persist the next time you run docker with this method. (See Further Instructions on how to persist across executions).

From the host:

Execute the application automatically from the host with the following command, you can execute the same as above, but without the --entrypoint bash part, and then tack on to the end the commands. For example, to output the version number:

docker run -it --rm mbpy_mbpycli version
# or:
docker run -it --rm mbpy_mbpycli import students

Note however this method does not persist across executions. To learn how to enable the ability to persist, see Further Instructions.

Last updated