拉取镜像:
docker pull ubuntu:16.04
docker run -it --rm -v /root/fs/work/testdir/bitcoindir:/home/code ubuntu:16.04
构造环境:
apt-get update
apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3
apt-get install libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev
apt-get install libzmq3-dev
测试编译 bitcoin的代码是成功的
构造bitcoin的docker镜像:
root@tazPad:~/fs/work/create_docker/docker_bitcoin# tree
.
├── build.sh 脚本
├── context 文件夹
└── Dockerfile 文件
其中build.sh的内容是
docker build --tag="ubuntu_16.04:v1.0" --file="./Dockerfile" ./context
其中Dockerfile的内容是
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y build-essential libtool autotools-dev automake pkg-config bsdmainutils python3
RUN apt-get install -y libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev
执行./build.sh
生成了预准备了编译环境的镜像;
root@tazPad:~/fs/work/create_docker/docker_bitcoin# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu_16.04 v1.0 6ef054314eab 16 minutes ago 535MB
ubuntu 16.04 a51debf7e1eb 2 weeks ago 116MB
ubuntu <none> b9e15a5d1e1a 3 months ago 115MB
dbctraining/tensorflow-gpu v0.2.0 ce79cfe5024c 4 months ago 3.98GB
dbctraining/tensorflow-gpu <none> 64059bb4f02b 4 months ago 3.98GB
nvidia/cuda latest 4d5a5e1f34f4 4 months ago 1.95GB
dbctraining/dbc_compile v3 c991d9c37f82 4 months ago 3.24GB
dbctraining/tensorflow-cpu-0.1.0 v1 f787e7381041 4 months ago 4.16GB
hello-world latest 2cb0d9787c4d 5 months ago 1.85kB
ubuntu 15.10 9b9cb95443b5 2 years ago 137MB
可以使用新镜像了
docker run -it --rm -v /root/fs/work/testdir/bitcoindir:/home/code ubuntu_16.04:v1.0