Docker Setup

Running the Apiwallet as a docker container. For information about docker see The docker image strawpay/apiwallet is available on dockerhub. The image exposes port 9000. You will need an auth token from Strawpay, see Quick Start for how to obtain one. In the following replace <my-auth> with your auth token.

NOTE You should mount the wallet directory from outside the docker container. Otherwise you may lose all bitcoin.

Create a docker volume to store the bitcoin wallets and other data.

docker volume create --name wallets
docker run --rm -v wallets:/var/wallets alpine chown daemon:daemon /var/wallets

Then start using:

docker run -v wallets:/var/wallets -p 9000:9000 --name apiwallet strawpay/apiwallet


The wallet can be configured with command line overrides, environment variables and/or a configuration file. In the following examples we will configure the issuer auth with the value my_auth in different ways. The examples is given with plain docker run. For information about the configuration see Configuration

Command Line Overrides

docker run -v wallets:/var/wallets -p 9000:9000 --name apiwallet strawpay/apiwallet -Dapiwallet.stroem.issuer.auth=my_auth

Environment Variables

docker run -e ISSUER_AUTH=my_auth -v wallets:/var/wallets -p 9000:9000  --name apiwallet strawpay/apiwallet 

Configuration File

To use a configuration file it is recommended to include the default configuration file. Create a file my.conf with the content:

include classpath("application.conf")
apiwallet.stroem.issuer.auth = my_auth

There are several ways to get the configuration file accessible to the container. Hera are a two.

Including configuration in a new docker image

Create Dockerfile next to my.conf with the following content:

FROM strawpay/apiwallet
COPY my.conf /opt/docker/conf/apiwallet.conf

Build the new image with

docker build -t mywallet .


docker run -v wallets:/var/wallets -p 9000:9000 --name mywallet mywallet   

Mapping a host file

mkdir -p /var/apiwallet/conf
cp my.conf /var/apiwallet/conf  

Then start with

docker run -v wallets:/var/wallets -v /var/apiwallet/conf/my.conf:/opt/docker/conf/appliction.conf:ro -p 9000:9000 strawpay/apiwallet


Options When Running the Container

Other options, e.g. -Dlogback.configurationFile added in a similar fashion. You can also pass in jvm options using a -J prefix, e.g. -J-Xmx512m. In the example below we have put my_logback.xml in /var/apiwallet/conf.

docker run -d -v /var/apiwallet/conf:/conf -v wallets:/var/wallets \
-p 9000:9000 --name apiwallet strawpay/apiwallet \
-Dconfig.file=/conf/my.conf \
-Dlogback.configurationFile=/conf/my_logback.xml -J-Xmx512m

Verify That the Container is Running.

docker ps

In a browser use http://localhost:9000, or use the ping operation

curl localhost:9000/ping


The logs can be accessed with

docker logs [-f] apiwallet 

For more information on how to set up logging see the configuration

Enabling the Console

The Apiwallet have an optional interactive console. To enable it you need to do three things

  1. Set the property apiwallet.console.enable to true.
  2. Disable logging to standard out by removing the stdout appender in the logback configuration
  3. Add -it to the docker run command.

Here we have removed the stdout appender i /var/apiwallet/conf/my_logback.xml:

 docker run -it /var/apiwallet/conf:/conf:ro -v wallets:/var/wallets \
-p 9000:9000 --name apiwallet strawpay/apiwallet \
-Dapiwallet.console.enble=true \

Failed to Start

If the issuer auth value is not set in the configuration you will se an exception:

com.strawpay.apiwallet.ConfigException: No configuration setting found for key 'apiwallet.stroem.issuer.auth'

When restarting you may see the following message:

docker: Error response from daemon: Conflict. The name "/apiwallet" is already in use by container babdf06c8612eb02d4ac6ede737a1267a01f586548f3416664003b6cb3a78944. You have to remove (or rename) that container to be able to reuse that name..
See 'docker run --help'.

The easy fix is

docker rm [-f] apiwallet