跳至內容

Greengrass v2 equivalent to Docker's `--network=host`

0

We're migrating some components running inside a docker container to Greengrass v2 and use "isolationMode": "GreengrassContainer" in our recipe. It all works well but I wonder whether we can achieve the equivalent of Docker's --network=host.

What I want to achieve is a network connection from inside the component to bind straight to the host port while the file system to be isolated from the host's file system.

Is something like that possible?

已提問 1 年前檢視次數 272 次
2 個答案
0

Example Use Case:

If your component needs to run a web server that should be accessible on the host's network interface, using NetworkMode: host allows it to bind to the host's ports directly without needing to map ports explicitly.

By configuring your Greengrass component in this manner, you can achieve network behavior similar to Docker's --network=host while maintaining control over file system isolation.

已回答 1 年前
  • Thank you for your help. Let me clarify, my Greengrass v2 does runs as a service on the host machine not inside a container. It's just the component that runs inside a container. NetworkMode: host does sound very promising. I've checked again the documentation for LambdaLinuxProcessParams (https://docs.aws.amazon.com/greengrass/v2/APIReference/API_LambdaLinuxProcessParams.html) but can't find it. Can you point me to the documentation please?

  • Hey George. Don't use Lambda's but run Docker locally on the same host as Greengrass. Your component in that case would instantiate the container (with command to bind to host's network). You can do this via direct docker run or use a compose file. Note that you then need to address file system isolation at the container level, but that's standard use case for docker volumes.

0

Yes, you can achieve the equivalent of Docker's --network=host in AWS IoT Greengrass v2, but it requires configuring your Greengrass component to use the host network mode. This way, your Greengrass component will have the same network namespace as the host, allowing it to bind to the host ports directly.

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。