Zcashd in docker on mac

Just for laughs I tried to run zcashd on my mac, in docker. Turns out it's pretty easy! I ran it in docker for mac, with this Dockerfile:

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends apt-transport-https ca-certificates wget
RUN wget -O - https://apt.z.cash/zcash.asc | apt-key add -

RUN echo "deb https://apt.z.cash/ jessie main" | tee /etc/apt/sources.list.d/zcash.list

RUN apt-get update && apt-get install -y zcash

RUN zcash-fetch-params

CMD zcashd

# docker build -t zcash
# docker run -v /Users/<whoever>/.zcash:/root/.zcash --name zcashd --rm -ti zcash

As the comments at the bottom say, build and run it that way, substituting your username for to map your local .zcash directory into the container.

I use a couple of shell scripts in ~/bin to make it more seamless:



exec docker run -v /Users/<me>/.zcash:/root/.zcash --name zcashd --rm -ti zcash



exec docker exec zcashd zcash-cli "$@"

With docker allowed to take 4 cores of my i7-4770, it runs at a little over 7 Sol/s. If I boot into ubuntu and run with 8 threads I get around 11 IIRC.

1 Like

How exactly did you do that? My docker container only reaches .8sol/s, and it only sees one processor for come reason (echo $(nproc) == 1)

Also, I tried a configuration that's really similar to yours and my container starts validating all of the transactions every time it starts. Yours should do the same. Where you able to solve this?

I tried to use persistent data, but it doesn't seem to work on my machine because of an issue between the db system zcashd uses and the virtualbox based docker volumes (it should work all right with the native docker, which doesn't run on my machine, unfortunately, because of the processor not supporting Apple HyperVisor technology, as I understand it).

Well, I was using native docker. So all the persistent data under .zcash was stored in the host file system (see the -v flag to the docker run command above) and every time I start the container it can pick up where it left off. I suppose native docker probably also explains the CPU count difference. .8 sounds pretty low though, are you using the tromp solver?

Yes and I'm getting 4sol/s on a virtualbox vm (without docker). As I understand, you're not using any additional flag to configure docker to use all of the processors, correct?

Native docker has a little menu bar thing that lets you configure how much RAM/CPU to give to docker (doesn't appear ot be a hard reservation, just a limit). I adjusted that to let docker use 4 cores.