欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

制作一个节点的镜像

程序员文章站 2024-03-12 17:13:32
...

[email protected]:/home/ucsmy# docker run -it –name ubueth -p 8020:8020 ebcd9d4fca80
然后需要更新一下包

apt-get update

准备工作

apt-get install python-software-properties
 apt-get install software-properties-common
 apt-get  install  vim 

安装geth

 add-apt-repository -y ppa:ethereum/ethereum
 apt-get update
 apt-get install ethereum
mkdir private-geth
cd private-geth
vim genesis.json

{
    "config": {
        "chainId": 12345,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "coinbase" : "0x0000000000000000000000000000000000000000",
    "difficulty" : "0x400",
    "extraData" : "0x123456",
    "gasLimit" : "0xffffffff",
    "nonce" : "0x0000000000000042",
    "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "timestamp" : "0x00",
    "alloc": { }
}

初始化geth并且进入geth

geth --datadir ./data init genesis.json
geth --identity "haha"  --nodiscover  --datadir ./data --networkid 12345  --rpcapi "db,eth,net,web3" --port 2221 --rpcport 3331 console

先跑一个容器

docker run –name test1 -it daocloud.io/ubuntu /bin/bash

然后在容器里面更新一下

[email protected]:/# apt-get update -y
1
1
退出容器,commit一下

[email protected]:~$ docker commit test1 daocloud.io/ubuntu/test1
sha256:b7f27fa969f5eb592625e673c16b2f2dda1e31bcdbeb8d29644e41e61645c03a

[email protected]:/home/ucsmy# docker run -it –name ubueth -p 8020:8020 ebcd9d4fca80

docker commit ubueth ebcd9d4fca80/ubueth