How to run sandbox on docker

How we can run the sandbox on docker container?

2 Likes

We provide a docker container containing an SDK installation https://hub.docker.com/r/digitalasset/daml-sdk. Note that this is only intended for development, for a production usecase you are better off building a smaller docker containing containing just the JSON API or DAML on SQL but given that Sandbox is only a development tool anyway this shouldn’t be an issue here. Here’s an example of how you can use it:

docker run -p 6865:6865 digitalasset/daml-sdk:1.7.0 daml sandbox
3 Likes

@cocreature I’m thinking of using this image as a base image and just creating a new image since I want some other binaries running in the container too. (I’ve actual already build a inhouse DAML container, but I’m considering using yours depending on which one offers persistence the best.)

If I were to wrap this in a K8s deployment, do you have any idea how I could persist the data of the Sandbox with Postgres? I’ve tried this What's the difference between Daml Driver for Postgres and Daml Sandbox w/ Postgres? - #8 by perbergman, but no luck.

2021-04-15 08:26:04.986 UTC [85] FATAL:  password authentication failed for user "sanbox-participant"
2021-04-15 08:26:04.986 UTC [85] DETAIL:  Role "sanbox-participant" does not exist.
	Connection matched pg_hba.conf line 99: "host all all all md5"

I suppose I’d have to configure the container? Not sure. However, I get the deprecated method working, but when I restart the runtime the ledgerId changes and then can’t access the Postgres container I’ve got going.

I’m basically just looking for a development environment to run the DAML contact, use the JSON HTTP API, and to persist the data, so that on a restart it restores its state. of the Sandbox. Any advice?

Kind regards,
Hendre

You can pass a --ledgerid option to the sandbox. If it has the same ledgerid as the one in the database it will pick up from where it left.

1 Like

@Gary_Verhaegen Thank you for your reply. I’ll test it right away.

Not sure if that’s the issue here but there is also a typo in your example: sanbox-participant instead of sandbox-participant.

I think it’s also worth pointing out that neither the docker container here nor the persistence in Sandbox are intended or supported for production usage. For that, either use the docker container for Daml on SQL if you have a license for that or build your own based on the JAR available on github releases.

@Gary_Verhaegen Thank you so much. Works great. Everything persisted.

@cocreature Yes, I’m well aware. This is just to demo. But I’d like to keep the data for a few days since we would like to query the data from the contract for the next few days. And thank you for the reply.