Reputation: 10163
I am creating Dockerfile
to run ethereum node on ubuntu container.
I want to run the below shell commands one after another sequentially in the container.
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
I have create below Entrypoint in the Dockerfile which I believe incorrect.
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"]
can anyone correct the ENTRYPOINT
for the above shell command.
Upvotes: 3
Views: 9974
Reputation: 5307
Put the two commands in a shell script, COPY
the shell script in the Dockerfile, then use that shell script as the entrypoint.
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"]
Be sure to chmod +x
the script, either before copying or in a RUN
command in the Dockerfile.
Upvotes: 6