Cogment Verse support development using Docker.
- Install Docker 23.0.1
- Install docker compose plugin v2.16.0. Docker Compose commands may not work with earlier versions.
To run Cogment Verse from docker containers:
-
Build the
cogment_verse
service's image. From the project's root, run the command:$ docker compose build
By default, the base image will be
python:3.9
. Pass the BASE_IMAGE build argument to modify it.$ docker compose build --build-arg BASE_IMAGE=python:3.9
-
Launch the container services using docker compose using the command:
$ docker compose run --service-ports cogment_verse [ARGS...]
This is equivalent to running
python -m main
locally.The same way it is done locally, you can add specific config arguments for hydra. Example:
$ docker compose run --service-ports cogment_verse +experiment=simple_bc/mountain_car
-
In case the default ports to access the web app, the orchestrator's web endpoint as well as mlflow are not available, you can specify alternates using the following environment variables. The default port values are the following:
WEB_PORT=8080
ORCHESTRATOR_WEB_PORT=9000
MLFLOW_PORT=3000
For example, to use a different port for the web app and mlflow, use the command:
$ WEB_PORT=8081 MLFLOW_PORT=5000 docker compose run --service-ports cogment_verse
-
Open Chrome (other web browser might work but haven't tested) and navigate to http://localhost:8080
To run the docker version on a remote instance, make sure that the default ports are available. See the section above to pass a different combination of ports. Additionally, in order to connect to the remotly hosted web app from your browser, you must pass the public address of the host instance through the WEB_HOST
environment variable.
For example, from the remote instance, run the command:
$ WEB_HOST=[public ip address] docker compose run --service-ports cogment_verse
Open Chrome (other web browser might work but haven't tested) and navigate to http://[public ip address]:8080
On M1/M2 Macs you'll need to force Docker to use the linux/amd64
platform as a few dependencies are not availabe for linux/arm64
. The environment variable DOCKER_DEFAULT_PLATFORM
needs to be set to linux/amd64
, e.g:
$ DOCKER_DEFAULT_PLATFORM=linux/amd64 docker compose build