简体   繁体   中英

How can I setup Docker container with individual IP address on EC2 instance?

I'm currently try to setup a hadoop cluster by Docker on EC2. Namely, I have several EC2 instances, for each instance, there is a docker container which is running hadoop program. But the connection between containers is tricky in Docker, so I want assign individual IP address for every container, How can I do it?

What can I do if I want to assign an individual IP for Docker container on EC2?

When you run a docker container, you can specify the network. --net="host" means that the container shares network stack of the host computer.

You can assign multiple IPs to your EC2 instance and then run hadoop containers such as

docker run --net="host" hadoop

This will give the container access to all network interfaces and you can decide in the container which one to bind to.

However please note the following warning:

--net="host" gives the container full access to local system services such as D-bus and is therefore considered insecure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM