Using the GoshawkDB Docker image
A Docker image is available for GoshawkDB. This is
intended to be used for ease of getting started with
GoshawkDB. The image is a minimal image (around 12MB
compressed), containing only that which is needed to run
GoshawkDB under Docker: it
contains libc
, gosu
, busybox
,
a linker, and GoshawkDB
. For deploying
GoshawkDB in production using Docker, we recommend you
build your own Docker images in keeping with the rest of
your deployed software so that you have a uniform approach
to updates and security.
The Docker image can be pulled from Docker Hub:
> docker pull goshawkdb/goshawkdb-server:0.3.1
The Docker image can also be downloaded from the downloads page, and loaded into Docker with:
> docker load < goshawkdb-server-docker-image_0.3.1.tar.gz
The Docker image expects a volume to be made available
at /data
in which it stores all state and
configuration. In particular, it expects:
/data/goshawkdb
- a writable directory to store data in./data/config.json
- the GoshawkDB cluster configuration./data/clusterCert.pem
- the GoshawkDB cluster certificate.
To get started, the image supports a setup
command, which can be used to populate
the /data
volume with a simple configuration,
a fresh cluster certificate, and a fresh client
certificate key pair. For example:
> docker run -v $HOME/goshawkdb1:/data goshawkdb/goshawkdb-server:0.3.1 setup
Once that command completes, you should find
in $HOME/goshawkdb1
the above files, plus
a clientKeyPair.pem
file which contains the
fresh client certificate key pair. Please inspect
the config.json
file in the context of both
the getting started guide and
the configuration
guide.
With the necessary files provided, you should now be able to start GoshawkDB in a container using the default command. You may want to expose the default GoshawkDB port (7894) to at least the host:
> docker run -p 127.0.0.1:7894:7894 -v $HOME/goshawkdb1:/data goshawkdb/goshawkdb-server:0.3.1
GoshawkDB should start up and declare itself ready for
client connections. From your host, you should then be
able to connect to it at 127.0.0.1:7894
.
The Docker image is intended to be treated as a black-box: at no point should you ever need to open a shell in it or otherwise poke about inside.
What's next?
- Whether you're using Docker or not, it's a good idea to read the getting started guide to learn how to build larger clusters.
- There is also the configuration guide covering the contents of the configuration file in detail.