Running in Docker

Canton is published to the digitalasset/canton dockerhub repository. The canton executable is the default image entry point so all examples using bin/canton can simply substitute that with docker run digtialasset/canton.

For example, to run our example simple topology:

docker run --rm digitalasset/canton --config examples/simply-topology.conf

The --rm option ensures that the container is removed when the canton process exits.

The default working directory of the container is /canton. This directory contains the same content as the release archive (daml, dar, examples).

By default docker will pull the latest tag containing the latest Canton release. As docker will only automatically pull latest once, ensure you have the latest version by periodically running docker pull digitalasset/canton.

Previous releases can be run by specifying their tag docker run --rm digitalasset/canton:0.0.27.

Supplying custom configuration and DARs

To expose files to the canton container you must specify a volume mapping from the host machine to the container.

For example, if you have the local directory my-application containing your custom canton configuration and DAR:

docker run --rm \
   --volume "$PWD/my-application:/canton/my-application" \
   digitalasset/canton --config /canton/my-application/my-config.conf

DARs can be loaded using the same container local path.

Exposing the ledger-api to the host machine

Applications using Canton will typically need access to the ledger-api to read from and write to the ledger. Each participant binds the ledger-api to the port specified at the configuration key: ledger-api.port. For participant1 in the simple topology example this is set to port 10011.

To expose the ledger-api to port 10011 on the host machine, run docker with the following options:

docker run --rm \
   --port 10011:10011 \
   digitalasset/canton --config examples/01-simple-topology/simple-topology.conf

The ledger-api port for each participant will need to be mapped separately.