Add alpine image variants

This commit is contained in:
Rui Marinho 2016-02-21 22:26:58 +00:00
parent 912468f533
commit f76a6c085e
12 changed files with 364 additions and 239 deletions

View File

@ -8,12 +8,14 @@ before_script:
env:
- VERSION=0.12
- VERSION=0.12/alpine
- VERSION=0.11
- VERSION=0.11/alpine
language: bash
script:
- docker build -t "$image" .
- docker run "$image" | grep "v$VERSION"
- docker run "$image" --version | grep "Bitcoin Core"
services: docker

View File

@ -1,28 +1,42 @@
FROM debian:latest
MAINTAINER Rui Marinho <rui.marinho@seegno.com>
MAINTAINER Rui Marinho <rui.marinho@seegno.com> (@ruimarinho)
RUN groupadd -r bitcoin && useradd -r -g bitcoin bitcoin
ENV GOSU_VERSION "1.7"
RUN apt-get update -y \
&& apt-get install -y curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV BITCOIND_VERSION 0.11.2
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu
ENV BITCOIN_DATA /home/bitcoin/.bitcoin
ENV BITCOIN_VERSION 0.11.2
ENV PATH /opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH
RUN curl -SL https://bitcoin.org/laanwj-releases.asc | gpg --import \
&& curl -SLO "https://bitcoin.org/bin/bitcoin-core-${BITCOIND_VERSION}/SHA256SUMS.asc" \
&& curl -SLO "https://bitcoin.org/bin/bitcoin-core-${BITCOIND_VERSION}/bitcoin-${BITCOIND_VERSION}-linux64.tar.gz" \
&& curl -SLO "https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc" \
&& curl -SLO "https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-linux64.tar.gz" \
&& gpg --verify SHA256SUMS.asc \
&& grep " bitcoin-${BITCOIND_VERSION}-linux64.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \
&& tar -xzf "bitcoin-${BITCOIND_VERSION}-linux64.tar.gz" -C /opt \
&& rm "bitcoin-${BITCOIND_VERSION}-linux64.tar.gz" SHA256SUMS.asc
&& grep " bitcoin-${BITCOIN_VERSION}-linux64.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \
&& tar -xzf "bitcoin-${BITCOIN_VERSION}-linux64.tar.gz" -C /opt \
&& rm "bitcoin-${BITCOIN_VERSION}-linux64.tar.gz" SHA256SUMS.asc
ENV PATH /opt/bitcoin-${BITCOIND_VERSION}/bin:$PATH
VOLUME ["/home/bitcoin/.bitcoin"]
VOLUME ["/var/lib/bitcoind"]
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8332 8333 18332 18333 18444
ENTRYPOINT ["bitcoind"]
CMD ["--version"]
CMD ["bitcoind"]

View File

@ -1,87 +0,0 @@
# seegno/bitcoind
A bitcoind docker image.
[![seegno/bitcoind][docker-pulls-image]][docker-hub-url]
[![seegno/bitcoind][docker-stars-image]][docker-hub-url]
[![seegno/bitcoind][docker-size-image]][docker-hub-url]
[![seegno/bitcoind][docker-layers-image]][docker-hub-url]
## What is bitcoind?
*from [bitcoinwiki](https://en.bitcoin.it/wiki/Bitcoind)*
bitcoind is a program that implements the Bitcoin protocol for remote procedure call (RPC) use. It is also the second Bitcoin client in the network's history.
## Usage
### How to use this image
Create a `Dockerfile` in the root of application directory:
```Dockerfile
FROM seegno/bitcoind:0.11
```
Then simply run:
```sh
$ docker build -t bitcoind
$ docker run --rm -it bitcoind
```
This image behaves like a binary, so you can pass any arguments to the bitcoind command to start it as needed:
```sh
$ docker run --rm -it bitcoin \
-datadir=/var/lib/bitcoind \
-printtoconsole \
-regtest=1 \
-rest \
-rpcallowip=172.17.0.0/16 \
-rpcpassword=bar \
-rpcuser=foo \
-server
```
You can also mount a directory it in a volume under `/var/lib/bitcoind` in case you want to access it on the host:
```
$ docker run -v ${PWD}/data:/var/lib/bitcoind -it --rm bitcoin \
-datadir=/var/lib/bitcoind \
-printtoconsole \
-regtest=1 \
-rest \
-rpcallowip=172.17.0.0/16 \
-rpcpassword=bar \
-rpcuser=foo \
-server
```
## Image Variants
The `seegno/bitcoind` image comes in a single flavor:
### `seegno/bitcoind:latest`
Tag that points to the latest bitcoind release available.
### `seegno/bitcoind:<version>`
Based on a slim Debian image, it targets a specific version branch of bitcoind (e.g. 0.11.x).
## Supported docker versions
This image is officially supported on docker version 1.7.1, with support for older versions provided on a best-effort basis.
## License
[License information](https://github.com/bitcoin/bitcoin/blob/master/COPYING) for the software contained in this image.
[License information](https://github.com/seegno/docker-bitcoind/blob/master/LICENSE) for the `seegno/bitcoind` docker project.
[docker-hub-url]: https://hub.docker.com/r/seegno/bitcoind
[docker-layers-image]: https://img.shields.io/imagelayers/layers/seegno/bitcoind/0.11.svg
[docker-pulls-image]: https://img.shields.io/docker/pulls/seegno/bitcoind.svg
[docker-size-image]: https://img.shields.io/imagelayers/image-size/seegno/bitcoind/0.11.svg
[docker-stars-image]: https://img.shields.io/docker/stars/seegno/bitcoind.svg

80
0.11/alpine/Dockerfile Normal file
View File

@ -0,0 +1,80 @@
FROM alpine:latest
MAINTAINER Rui Marinho <rui.marinho@seegno.com> (@ruimarinho)
RUN set -eof pipefail
RUN addgroup bitcoin && adduser -S -G bitcoin bitcoin
ENV GOSU_VERSION "1.7"
ENV GOSU_SHASUM "34049cfc713e8b74b90d6de49690fa601dc040021980812b2f1f691534be8a50 /usr/local/bin/gosu"
RUN apk --no-cache add openssl \
&& wget -O /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64 \
&& echo "${GOSU_SHASUM}" | sha256sum -c \
&& chmod +x /usr/local/bin/gosu
ENV BERKELEYDB_VERSION "db-4.8.30.NC"
ENV BERKELEYDB_PREFIX "/opt/${BERKELEYDB_VERSION}"
ENV BITCOIN_VERSION "0.11.2"
ENV BITCOIN_PREFIX "/opt/bitcoin-${BITCOIN_VERSION}"
ENV BITCOIN_SHASUM "aab2cd0c4f045970d259cf9fcee5785b43180d20ccbbedc1f90480e697696b25 v0.11.2.tar.gz"
ENV BITCOIN_DATA "/home/bitcoin/.bitcoin"
ENV PATH "${BITCOIN_PREFIX}/bin:$PATH"
RUN buildDependencies="autoconf \
automake \
boost-dev \
build-base \
chrpath \
libevent-dev \
libtool \
linux-headers \
openssl-dev \
protobuf-dev \
zeromq-dev" \
runtimeDependencies="boost \
boost-program_options \
libevent \
libzmq" \
&& apk --no-cache add ${buildDependencies} \
&& mkdir -p /tmp/build \
&& wget -O /tmp/build/${BERKELEYDB_VERSION}.tar.gz "http://download.oracle.com/berkeley-db/${BERKELEYDB_VERSION}.tar.gz" \
&& tar -xzf "/tmp/build/${BERKELEYDB_VERSION}.tar.gz" -C /tmp/build/ \
&& sed s/__atomic_compare_exchange/__atomic_compare_exchange_db/g -i "/tmp/build/${BERKELEYDB_VERSION}/dbinc/atomic.h" \
&& mkdir -p "${BERKELEYDB_PREFIX}" \
&& cd "/tmp/build/${BERKELEYDB_VERSION}/build_unix" \
&& ../dist/configure --enable-cxx --disable-shared --with-pic --prefix="${BERKELEYDB_PREFIX}" \
&& make install \
&& wget -O "/tmp/build/v${BITCOIN_VERSION}.tar.gz" "https://github.com/bitcoin/bitcoin/archive/v${BITCOIN_VERSION}.tar.gz" \
&& cd /tmp/build \
&& echo "${BITCOIN_SHASUM}" | sha256sum -c \
&& tar -xzf v${BITCOIN_VERSION}.tar.gz \
&& cd "/tmp/build/bitcoin-${BITCOIN_VERSION}" \
&& ./autogen.sh \
&& ./configure LDFLAGS="-L${BERKELEYDB_PREFIX}/lib/" CPPFLAGS="-I${BERKELEYDB_PREFIX}/include/" \
--prefix="${BITCOIN_PREFIX}" \
--mandir=/usr/share/man \
--disable-tests \
--disable-bench \
--disable-ccache \
--with-gui=no \
--with-utils \
--with-libs \
--with-daemon \
&& make install \
&& cd / \
&& strip "${BITCOIN_PREFIX}/bin/bitcoind" "${BITCOIN_PREFIX}/bin/bitcoin-tx" "${BITCOIN_PREFIX}/bin/bitcoin-cli" \
&& rm -rf "/tmp/build" \
&& apk --no-cache --purge del ${buildDependencies} \
&& apk --no-cache add ${runtimeDependencies}
VOLUME ["/home/bitcoin/.bitcoin"]
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8332 8333 18332 18333 18444
CMD ["bitcoind"]

View File

@ -0,0 +1,27 @@
#!/bin/sh
set -e
if test $(echo "$1" | cut -c1) = '-'; then
echo "$0: assuming arguments for bitcoind"
set -- bitcoind "$@"
fi
if test $(echo "$1" | cut -c1) = '-' || test "$1" = 'bitcoind'; then
mkdir -p "$BITCOIN_DATA"
chmod 700 "$BITCOIN_DATA"
chown -R bitcoin "$BITCOIN_DATA"
echo "$0: setting data directory to $BITCOIN_DATA"
set -- "$@" -datadir="$BITCOIN_DATA"
fi
if [ "$1" = 'bitcoind' ] || [ "$1" = 'bitcoin-cli' ] || [ "$1" = 'bitcoin-cli' ]; then
echo
exec gosu bitcoin "$@"
fi
echo
exec "$@"

27
0.11/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
set -e
if test $(echo "$1" | cut -c1) = '-'; then
echo "$0: assuming arguments for bitcoind"
set -- bitcoind "$@"
fi
if test $(echo "$1" | cut -c1) = '-' || test "$1" = 'bitcoind'; then
mkdir -p "$BITCOIN_DATA"
chmod 700 "$BITCOIN_DATA"
chown -R bitcoin "$BITCOIN_DATA"
echo "$0: setting data directory to $BITCOIN_DATA"
set -- "$@" -datadir="$BITCOIN_DATA"
fi
if [ "$1" = 'bitcoind' ] || [ "$1" = 'bitcoin-cli' ] || [ "$1" = 'bitcoin-cli' ]; then
echo
exec gosu bitcoin "$@"
fi
echo
exec "$@"

View File

@ -1,29 +1,43 @@
FROM debian:latest
MAINTAINER Rui Marinho <rui.marinho@seegno.com>
MAINTAINER Rui Marinho <rui.marinho@seegno.com> (@ruimarinho)
RUN groupadd -r bitcoin && useradd -r -g bitcoin bitcoin
ENV GOSU_VERSION "1.7"
RUN apt-get update -y \
&& apt-get install -y curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV BITCOIND_VERSION 0.12.0
ENV BITCOIND_TEST_VERSION rc5
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu
ENV BITCOIN_DATA /home/bitcoin/.bitcoin
ENV BITCOIN_TEST_VERSION rc5
ENV BITCOIN_VERSION 0.12.0
ENV PATH /opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH
RUN curl -SL https://bitcoin.org/laanwj-releases.asc | gpg --import \
&& curl -SLO "https://bitcoin.org/bin/bitcoin-core-${BITCOIND_VERSION}/test/SHA256SUMS.asc" \
&& curl -SLO "https://bitcoin.org/bin/bitcoin-core-${BITCOIND_VERSION}/test/bitcoin-${BITCOIND_VERSION}${BITCOIND_TEST_VERSION}-linux64.tar.gz" \
&& curl -SLO "https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/test/SHA256SUMS.asc" \
&& curl -SLO "https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/test/bitcoin-${BITCOIN_VERSION}${BITCOIN_TEST_VERSION}-linux64.tar.gz" \
&& gpg --verify SHA256SUMS.asc \
&& grep " bitcoin-${BITCOIND_VERSION}${BITCOIND_TEST_VERSION}-linux64.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \
&& tar -xzf "bitcoin-${BITCOIND_VERSION}${BITCOIND_TEST_VERSION}-linux64.tar.gz" -C /opt \
&& rm "bitcoin-${BITCOIND_VERSION}${BITCOIND_TEST_VERSION}-linux64.tar.gz" SHA256SUMS.asc
&& grep " bitcoin-${BITCOIN_VERSION}${BITCOIN_TEST_VERSION}-linux64.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \
&& tar -xzf "bitcoin-${BITCOIN_VERSION}${BITCOIN_TEST_VERSION}-linux64.tar.gz" -C /opt \
&& rm "bitcoin-${BITCOIN_VERSION}${BITCOIN_TEST_VERSION}-linux64.tar.gz" SHA256SUMS.asc
ENV PATH /opt/bitcoin-${BITCOIND_VERSION}/bin:$PATH
VOLUME ["/home/bitcoin/.bitcoin"]
VOLUME ["/var/lib/bitcoind"]
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8332 8333 18332 18333 18444
ENTRYPOINT ["bitcoind"]
CMD ["--version"]
CMD ["bitcoind"]

View File

@ -1,87 +0,0 @@
# seegno/bitcoind
A bitcoind docker image.
[![seegno/bitcoind][docker-pulls-image]][docker-hub-url]
[![seegno/bitcoind][docker-stars-image]][docker-hub-url]
[![seegno/bitcoind][docker-size-image]][docker-hub-url]
[![seegno/bitcoind][docker-layers-image]][docker-hub-url]
## What is bitcoind?
*from [bitcoinwiki](https://en.bitcoin.it/wiki/Bitcoind)*
bitcoind is a program that implements the Bitcoin protocol for remote procedure call (RPC) use. It is also the second Bitcoin client in the network's history.
## Usage
### How to use this image
Create a `Dockerfile` in the root of application directory:
```Dockerfile
FROM seegno/bitcoind:0.12
```
Then simply run:
```sh
$ docker build -t bitcoind
$ docker run --rm -it bitcoind
```
This image behaves like a binary, so you can pass any arguments to the bitcoind command to start it as needed:
```sh
$ docker run --rm -it bitcoin \
-datadir=/var/lib/bitcoind \
-printtoconsole \
-regtest=1 \
-rest \
-rpcallowip=172.17.0.0/16 \
-rpcpassword=bar \
-rpcuser=foo \
-server
```
You can also mount a directory it in a volume under `/var/lib/bitcoind` in case you want to access it on the host:
```
$ docker run -v ${PWD}/data:/var/lib/bitcoind -it --rm bitcoin \
-datadir=/var/lib/bitcoind \
-printtoconsole \
-regtest=1 \
-rest \
-rpcallowip=172.17.0.0/16 \
-rpcpassword=bar \
-rpcuser=foo \
-server
```
## Image Variants
The `seegno/bitcoind` image comes in a single flavor:
### `seegno/bitcoind:latest`
Tag that points to the latest bitcoind release available.
### `seegno/bitcoind:<version>`
Based on a slim Debian image, it targets a specific version branch of bitcoind (e.g. 0.12.x).
## Supported docker versions
This image is officially supported on docker version 1.10, with support for older versions provided on a best-effort basis.
## License
[License information](https://github.com/bitcoin/bitcoin/blob/master/COPYING) for the software contained in this image.
[License information](https://github.com/seegno/docker-bitcoind/blob/master/LICENSE) for the `seegno/bitcoind` docker project.
[docker-hub-url]: https://hub.docker.com/r/seegno/bitcoind
[docker-layers-image]: https://img.shields.io/imagelayers/layers/seegno/bitcoind/0.12.svg
[docker-pulls-image]: https://img.shields.io/docker/pulls/seegno/bitcoind.svg
[docker-size-image]: https://img.shields.io/imagelayers/image-size/seegno/bitcoind/0.12.svg
[docker-stars-image]: https://img.shields.io/docker/stars/seegno/bitcoind.svg

80
0.12/alpine/Dockerfile Normal file
View File

@ -0,0 +1,80 @@
FROM alpine:latest
MAINTAINER Rui Marinho <rui.marinho@seegno.com> (@ruimarinho)
RUN set -eof pipefail
RUN addgroup bitcoin && adduser -S -G bitcoin bitcoin
ENV GOSU_VERSION "1.7"
ENV GOSU_SHASUM "34049cfc713e8b74b90d6de49690fa601dc040021980812b2f1f691534be8a50 /usr/local/bin/gosu"
RUN apk --no-cache add openssl \
&& wget -O /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64 \
&& echo "${GOSU_SHASUM}" | sha256sum -c \
&& chmod +x /usr/local/bin/gosu
ENV BERKELEYDB_VERSION "db-4.8.30.NC"
ENV BERKELEYDB_PREFIX "/opt/${BERKELEYDB_VERSION}"
ENV BITCOIN_VERSION "0.12.0rc5"
ENV BITCOIN_PREFIX "/opt/bitcoin-${BITCOIN_VERSION}"
ENV BITCOIN_SHASUM "205a5dfa9b56412970eee152147eb3641fd4a01f4b668eb9c47344b7e03bd67c v0.12.0rc5.tar.gz"
ENV BITCOIN_DATA "/home/bitcoin/.bitcoin"
ENV PATH "${BITCOIN_PREFIX}/bin:$PATH"
RUN buildDependencies="autoconf \
automake \
boost-dev \
build-base \
chrpath \
libevent-dev \
libtool \
linux-headers \
openssl-dev \
protobuf-dev \
zeromq-dev" \
runtimeDependencies="boost \
boost-program_options \
libevent \
libzmq" \
&& apk --no-cache add ${buildDependencies} \
&& mkdir -p /tmp/build \
&& wget -O /tmp/build/${BERKELEYDB_VERSION}.tar.gz "http://download.oracle.com/berkeley-db/${BERKELEYDB_VERSION}.tar.gz" \
&& tar -xzf "/tmp/build/${BERKELEYDB_VERSION}.tar.gz" -C /tmp/build/ \
&& sed s/__atomic_compare_exchange/__atomic_compare_exchange_db/g -i "/tmp/build/${BERKELEYDB_VERSION}/dbinc/atomic.h" \
&& mkdir -p "${BERKELEYDB_PREFIX}" \
&& cd "/tmp/build/${BERKELEYDB_VERSION}/build_unix" \
&& ../dist/configure --enable-cxx --disable-shared --with-pic --prefix="${BERKELEYDB_PREFIX}" \
&& make install \
&& wget -O "/tmp/build/v${BITCOIN_VERSION}.tar.gz" "https://github.com/bitcoin/bitcoin/archive/v${BITCOIN_VERSION}.tar.gz" \
&& cd /tmp/build \
&& echo "${BITCOIN_SHASUM}" | sha256sum -c \
&& tar -xzf v${BITCOIN_VERSION}.tar.gz \
&& cd "/tmp/build/bitcoin-${BITCOIN_VERSION}" \
&& ./autogen.sh \
&& ./configure LDFLAGS="-L${BERKELEYDB_PREFIX}/lib/" CPPFLAGS="-I${BERKELEYDB_PREFIX}/include/" \
--prefix="${BITCOIN_PREFIX}" \
--mandir=/usr/share/man \
--disable-tests \
--disable-bench \
--disable-ccache \
--with-gui=no \
--with-utils \
--with-libs \
--with-daemon \
&& make install \
&& cd / \
&& strip "${BITCOIN_PREFIX}/bin/bitcoind" "${BITCOIN_PREFIX}/bin/bitcoin-tx" "${BITCOIN_PREFIX}/bin/bitcoin-cli" \
&& rm -rf "/tmp/build" \
&& apk --no-cache --purge del ${buildDependencies} \
&& apk --no-cache add ${runtimeDependencies}
VOLUME ["/home/bitcoin/.bitcoin"]
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8332 8333 18332 18333 18444
CMD ["bitcoind"]

View File

@ -0,0 +1,27 @@
#!/bin/sh
set -e
if test $(echo "$1" | cut -c1) = '-'; then
echo "$0: assuming arguments for bitcoind"
set -- bitcoind "$@"
fi
if test $(echo "$1" | cut -c1) = '-' || test "$1" = 'bitcoind'; then
mkdir -p "$BITCOIN_DATA"
chmod 700 "$BITCOIN_DATA"
chown -R bitcoin "$BITCOIN_DATA"
echo "$0: setting data directory to $BITCOIN_DATA"
set -- "$@" -datadir="$BITCOIN_DATA"
fi
if [ "$1" = 'bitcoind' ] || [ "$1" = 'bitcoin-cli' ] || [ "$1" = 'bitcoin-cli' ]; then
echo
exec gosu bitcoin "$@"
fi
echo
exec "$@"

27
0.12/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
set -e
if test $(echo "$1" | cut -c1) = '-'; then
echo "$0: assuming arguments for bitcoind"
set -- bitcoind "$@"
fi
if test $(echo "$1" | cut -c1) = '-' || test "$1" = 'bitcoind'; then
mkdir -p "$BITCOIN_DATA"
chmod 700 "$BITCOIN_DATA"
chown -R bitcoin "$BITCOIN_DATA"
echo "$0: setting data directory to $BITCOIN_DATA"
set -- "$@" -datadir="$BITCOIN_DATA"
fi
if [ "$1" = 'bitcoind' ] || [ "$1" = 'bitcoin-cli' ] || [ "$1" = 'bitcoin-cli' ]; then
echo
exec gosu bitcoin "$@"
fi
echo
exec "$@"

View File

@ -1,86 +1,87 @@
# seegno/bitcoind
A bitcoind docker image.
[![seegno/bitcoind][docker-pulls-image]][docker-hub-url]
[![seegno/bitcoind][docker-stars-image]][docker-hub-url]
[![seegno/bitcoind][docker-size-image]][docker-hub-url]
[![seegno/bitcoind][docker-layers-image]][docker-hub-url]
[![seegno/bitcoind][docker-pulls-image]][docker-hub-url] [![seegno/bitcoind][docker-stars-image]][docker-hub-url] [![seegno/bitcoind][docker-size-image]][docker-hub-url] [![seegno/bitcoind][docker-layers-image]][docker-hub-url]
## Supported tags and respective `Dockerfile` links
- `0.11` ([0.11/Dockerfile](https://github.com/seegno/docker-bitcoind/blob/master/0.11/Dockerfile))
- `0.12` ([0.12/Dockerfile](https://github.com/seegno/docker-bitcoind/blob/master/0.12/Dockerfile))
- `0.12.0-alpine`, `0.12-alpine` ([0.12/alpine/Dockerfile](https://github.com/seegno/docker-bitcoind/blob/master/0.12/alpine/Dockerfile))
- `0.12.0rc5`, `0.12`, `latest` ([0.12/Dockerfile](https://github.com/seegno/docker-bitcoind/blob/master/0.12/Dockerfile))
- `0.11-alpine` ([0.11/alpine/Dockerfile](https://github.com/seegno/docker-bitcoind/blob/master/0.11/alpine/Dockerfile))
- `0.11.2`, `0.11` ([0.11/Dockerfile](https://github.com/seegno/docker-bitcoind/blob/master/0.11/Dockerfile))
## What is bitcoind?
*from [bitcoinwiki](https://en.bitcoin.it/wiki/Bitcoind)*
_from [bitcoinwiki](https://en.bitcoin.it/wiki/Bitcoind)_
bitcoind is a program that implements the Bitcoin protocol for remote procedure call (RPC) use. It is also the second Bitcoin client in the network's history.
## Usage
### How to use this image
This image behaves like a binary, so you can pass any arguments to the bitcoind command to start it as needed:
This image contains the main binaries from the Bitcoin Core project - `bitcoind`, `bitcoin-cli` and `bitcoin-tx`. It behaves like a binary, so you can pass any arguments to the image and they will be forwarded to the `bitcoind` binary:
```sh
$ docker run --rm -it seegno/bitcoind \
-datadir=/var/lib/bitcoind \
-printtoconsole \
-regtest=1 \
-rest \
-rpcallowip=172.17.0.0/16 \
-rpcpassword=bar \
-rpcuser=foo \
-server
-rpcuser=foo
```
You can also mount a directory it in a volume under `/var/lib/bitcoind` in case you want to access it on the host:
By default, `bitcoind` will run as as user `bitcoin` for security reasons and with its default data dir (`~/.bitcoin`). If you'd like to customize where `bitcoind` stores its data, you must use the `BITCOIN_DATA` environment variable. The directory will be automatically created with the correct permissions for the `bitcoin` user and `bitcoind` automatically configured to use it.
```
$ docker run -v ${PWD}/data:/var/lib/bitcoind -it --rm seegno/bitcoind \
-datadir=/var/lib/bitcoind \
```sh
$ docker run --env BITCOIN_DATA=/var/lib/bitcoind --rm -it seegno/bitcoind \
-printtoconsole \
-regtest=1 \
-rest \
-rpcallowip=172.17.0.0/16 \
-rpcpassword=bar \
-rpcuser=foo \
-server
-regtest=1
```
You can also mount a directory it in a volume under `/home/bitcoin/.bitcoin` in case you want to access it on the host:
```sh
$ docker run -v ${PWD}/data:/home/bitcoin/.bitcoin -it --rm seegno/bitcoind \
-printtoconsole \
-regtest=1
```
You can optionally create a `Dockerfile` in the root of your application directory:
```Dockerfile
FROM seegno/bitcoind:latest
FROM seegno/bitcoind
```
Then simply run:
```sh
$ docker build -t bitcoind
$ docker run --rm -it bitcoind <args>
$ docker build -t my/bitcoind
$ docker run --rm -it my/bitcoind
```
Or with `docker-compose`:
```yml
bitcoind:
image: seegno/bitcoind
command:
-printtoconsole
-regtest=1
```
## Image variants
The `seegno/bitcoind` image comes in a single flavor:
The `seegno/bitcoind` image comes in multiple flavors:
### `seegno/bitcoind:latest`
Tag that points to the latest bitcoind release available.
Points to the latest release available of Bitcoin Core. Occasionally pre-release versions will be included.
### `seegno/bitcoind:<version>`
Based on a slim Debian image, targets a specific version branch or release of Bitcoin Core (e.g. `0.12.0rc5`, `0.12`).
Based on a slim Debian image, it targets a specific version branch of bitcoind (e.g. 0.11, 0.12).
### `seegno/bitcoind:<version>-alpine`
Based on Alpine Linux with Berkeley DB 4.8 (cross-compatible build), targets a specific version branch or release of Bitcoin Core (e.g. `0.12.0rc5`, `0.12`).
## Supported docker versions
This image is officially supported on docker version 1.10, with support for older versions provided on a best-effort basis.
## Supported Docker versions
This image is officially supported on Docker version 1.10, with support for older versions provided on a best-effort basis.
## License
[License information](https://github.com/bitcoin/bitcoin/blob/master/COPYING) for the software contained in this image.
[License information](https://github.com/seegno/docker-bitcoind/blob/master/LICENSE) for the [seegno/docker-bitcoind](https://hub.docker.com/r/seegno/bitcoind) docker project.