1 写Dockerfile
mkdir blc
cd blc
vim Dockerfile
FROM ubuntu:16.04
RUN apt-get update \
&& apt-get install software-properties-common -y \
&& add-apt-repository -y ppa:ethereum/ethereum \
&& apt-get update \
&& apt-get install ethereum -y
2 构建镜像
sudo docker build -t node:node1 .
flq1@ubuntu:~/blc$ sudo docker build -t node:node1 .
Sending build context to Docker daemon 2.048 kB
Step 1/2 : FROM ubuntu:16.04
---> 20c44cd7596f
Step 2/2 : RUN apt-get update && apt-get install software-properties-common -y && add-apt-repository -y ppa:ethereum/ethereum && apt-get update && apt-get install ethereum -y
---> Using cache
---> c4feb44697ed
Successfully built c4feb44697ed
flq1@ubuntu:~/blc$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
node node1 c4feb44697ed 4 hours ago 376 MB
3 用镜像创建容器
flq1@ubuntu:~/blc$ sudo docker run -it node:node1 /bin/bash
root@6b684add4ad8:/#