How to allow request from host machine and deny from other machine, using ethereum in docker?

0 votes

There is ethereum node runing in docker with command:  

sudo docker run -d --restart=always --name ethereum \ -p 8545:8545 \ -p 30303:30303 \ ethereum/client-go \ --rpc --rpcaddr "0.0.0.0" --syncmode light --rpcapi eth,personal 

with the option rpcaddr "0.0.0.0", the host machine can access ethereum node, but other machine with external ip also can.

How to deny external machine?

I know it can be done with iptables or some firewall.

Can it be done with docker itself?

Oct 9, 2018 in Blockchain by digger
• 27,640 points
40 views

1 answer to this question.

0 votes

You can restrict access to the port 8545 at host level. Just add 127.0.0.1 as the bind address for this port at docker run:

sudo docker run -d --restart=always --name ethereum \
    -p 127.0.0.1:8545:8545 \
    -p 30303:30303 \
    ethereum/client-go \
    --rpc --rpcaddr "0.0.0.0" --syncmode light --rpcapi eth,personal
answered Oct 9, 2018 by Omkar
• 67,460 points

Related Questions In Blockchain

0 votes
1 answer

How to prevent the smart contract from being modified and deployed in the blockchain network?

To expand on Matthew's answer, each state ...READ MORE

answered Jul 5, 2018 in Blockchain by ariaholic
• 7,340 points
51 views
0 votes
1 answer

How can I retrieve to and from address in transaction directly from blockchain?

The spending conditions, i.e., who is able ...READ MORE

answered Jul 11, 2018 in Blockchain by Shashank
• 10,350 points
68 views
0 votes
1 answer
0 votes
1 answer

How to get all address and send ethers in solidity using a loop?

I found a similar code somewhere: contract  Holders{ uint ...READ MORE

answered Jul 31, 2018 in Blockchain by digger
• 27,640 points
170 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,520 points
154 views
0 votes
1 answer

How to read the ETH value and other token values from an account?

You can do this eth.accounts shows you all known ...READ MORE

answered Oct 22, 2018 in Blockchain by Omkar
• 67,460 points
30 views
0 votes
1 answer