On non-Linux
and Linux
systems both, you can use oligopool
via docker
.
To follow this mini guide you will need to have git
and docker
installed.
The first step in the process is to build a oligopool
docker
image.
- Either manually or via terminal download or clone this repository.
$ git clone https://github.com/ayaanhossain/oligopool.git # Or, manually download repository
- Navigate into the repo.
$ cd oligopool
- And then, build the
docker
image from the repo.
$ docker build -t oligopool-docker . # Note the dot at the end
Note that the name of the image (
oligopool-docker
) is flexible, and can be anything we want.
- You can see a list of all
docker
images built on your system, if you need to recall for later.
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oligopool-docker latest 414f88c5e29c About a minute ago 1.76GB
With the docker
image created, we can now start a container within which oligopool
is available. You can then mount your project directory and start using Oligopool Calculator
.
- First, navigate to your project directory.
$ cd path/to/your/project
- If you are on
MacOS
orLinux
, you can spin a container fromoligopool-docker
image and load your project directory (pwd
path) asop-workspace
inside the container.
$ docker run -it -v $(pwd):/op-workspace --name op-container oligopool-docker # Loads your project directory
Note
op-workspace
is just a name for your project directory inside container we spinned up, could be anything. Similarlyop-container
is the name of container we spinned fromoligpool-docker
image.
- If you are on
Windows
, the syntax for this is slightly different.
$ docker run -it -v ${PWD}:/op-workspace --name op-container oligopool-docker # Loads your project directory
- Once the container is up and running, you can access your directory content.
$ ll # for example, will show you your project directory content
The terminal within the docker
container will now be a Linux
(Ubuntu) bash
prompt. You can now execute any oligopool
function or script from the terminal.
$ python
Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import oligopool as op
>>> op.__version__
- When you are done with the container work, simply exit from the terminal.
$ exit
- You can see a list of all running
docker
containers (not images) using
$ docker ps -a
which will even show you stopped containers you spinned earlier. If you want to remove stopped docker
containers, check the documentation.
Oligopool Calculator
for Design Mode
is best used interactively via jupyter
. Analysis Mode
functions could need to run for longer so perhaps better to be used via scripts.
Containers from the oligopool-docker
image we just created can connect to jupyter
. We will need to first map the port 8080
within the container to a port on our host machine.
- From your host machine terminal (this is outside the
container
prompt, so exit if you are within the container) map the port8080
within container to port8888
on your host and start an interactivebash
session from your project directory.
$ docker run -p 8888:8080 -it -v ${PWD}:/op-workspace --name op-container oligopool-docker
Note The port
8080
within thedocker
image is exposed by design. If you want to expose different ports, modify line 49 indockerfile
in the repo and rebuild the image. Similarly, feel free to map to any port other than8888
on your local host. You can even map8080
within container to8080
on your host.
- From the
bash
terminal within the container simply use the following
$ jupyter notebook --ip=0.0.0.0 --port=8080 --no-browser --allow-root
which will start a jupyter
notebook within the container, but now accessible at
http://localhost:8888
on your local browser. This is very similar to how we would start jupyter
notebooks from the terminal on our host.
Note If you want more packages within this docker image, you can modify lines 29 and 35 in our
dockerfile
.