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
1,387 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,180 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
1,714 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
2,299 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
1,584 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
3,689 views
+2 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
7,658 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,180 points
1,499 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,180 points
3,339 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