docker入口具有多个参数

我正在创buildDockerfile来在Ubuntu容器上运行ethereum节点。

我想在容器中依次运行下面的shell命令。

 geth --datadir /home/ubuntu/eth-dev init /home/ubuntu/eth-dev/genesis.json geth --networkid 45634 --verbosity 4 --ipcdisable --rpc --port 30301 --rpcport 8545 --rpcaddr 0.0.0.0 console 2>> /home/ubuntu/eth-dev/eth.log 

我在Dockerfile的Entrypoint下创build了一个我认为不正确的东西。

  ENTRYPOINT ["geth", "--datadir /home/ubuntu/eth-dev", "init /home/ubuntu/eth-dev/genesis.json", "--networkid 45634", "--verbosity 4", "--ipcdisable", "--rpc", "--port 30301", "--rpcport 8545", "--rpcaddr 0.0.0.0", "console 2>> /home/ubuntu/eth-dev/eth.log"] 

任何人都可以纠正上述shell命令的ENTRYPOINT

把这两个命令放在shell脚本中, COPY Dockerfile中的shell脚本,然后使用该shell脚本作为入口点。

docker-entrypoint.sh:

 geth --datadir /home/ubuntu/eth-dev init /home/ubuntu/eth-dev/genesis.json geth --networkid 45634 --verbosity 4 --ipcdisable --rpc --port 30301 --rpcport 8545 --rpcaddr 0.0.0.0 console 2>> /home/ubuntu/eth-dev/eth.log 

Dockerfile:

 COPY docker-entrypoint.sh /usr/bin/docker-entrypoint.sh ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"] 

确保在复制之前或在Dockerfile的RUN命令中chmod +x脚本。