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,720 points
303 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,190 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,440 points
348 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
439 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
185 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,720 points
1,875 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,060 points
1,556 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,190 points
263 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,190 points
1,238 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP