A Simple GUI (x11-based) Docker Container for Bitcoin Development
Install Docker
Install either of the two editions: Community Edition (CE) and Enterprise Edition (EE) by following Install Docker and Post-installation steps for Linux.
Create Dockerfile and Build Docker Image
Dockerfile
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
ARG user="bitcoindc" ARG uid=1000 ARG gid=1000 ARG home="/home/bitcoindc" ARG bitcoindb="/bitcoindb"
ENV DISPLAY $DISPLAY
ENV QT_X11_NO_MITSHM 1
RUN apt-get update RUN apt-get -y install x11-apps
RUN apt-get update && apt-get install -y zsh screen tree sudo ssh
RUN apt-get install -y zip unzip curl wget feh
RUN apt-get install -y git RUN apt-get install -y build-essential autoconf libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev libtool RUN apt-get install -y libevent-dev pkg-config
RUN apt-get update RUN apt-get install -y software-properties-common RUN add-apt-repository -y ppa:bitcoin/bitcoin RUN apt-get update RUN apt-get install -y bitcoind
EXPOSE 8332 8333 18332 18333
EXPOSE 22
VOLUME ${bitcoindb}
RUN export uid=${uid} gid=${gid} &&
groupadd -g ${gid} ${user} &&
useradd -m -u ${uid} -g ${user} -s /bin/bash ${user} &&
passwd -d ${user} &&
usermod -aG sudo ${user}
ADD . ${home}
RUN chown -R ${uid}:${gid} ${home}
ENV DEBIAN_FRONTEND teletype
USER
CMD ["/bin/bash"]
Build Docker Image
docker build -t bitcoindc:v0.0.1 .
Show Docker Image
docker images
Launch Docker Container with GUI (x11 based) Support
Launch Docker Container
docker run -it --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro -v /mnt/hgfs/bitcoindb:/bitcoindb -p 8333:8333 bitcoindc:v0.0.1
Test GUI Support
xclock &
Install Bitcoin Core on Docker Container
Once the docker container is launched, we could either install the pre-packaged Bitcoin Core or build from the source of Bitcoin Core.
Source: aixminds.com (http://aixminds.org/2018/04/09/a-simple-docker-container-for-bitcoin-gui-apps/) and medium.com (https://medium.com/@gmhuili/a-simple-docker-container-for-bitcoin-gui-apps-d4f6f448f078)