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
• 26,740 points
699 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
• 69,230 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 6, 2018 in Blockchain by aryya
• 7,460 points
767 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,400 points
1,266 views
0 votes
1 answer

How to download the full blocks (with transactions) directly and in parallel from the connected nodes in NodesGroup?

 just got informed, that NBitcoin currently does ...READ MORE

answered Jul 31, 2018 in Blockchain by Shashank
• 10,400 points
610 views
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
• 26,740 points
2,725 views
+2 votes
1 answer
+2 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
• 58,100 points
2,657 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
• 69,230 points
812 views
–1 vote
1 answer

How to get balance of all accounts in ethereum network using javascript?

You can write a function that will ...READ MORE

answered Jan 10, 2019 in Blockchain by Omkar
• 69,230 points
2,385 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP