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?

asked 3 months ago193 views
2 Answers
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.

profile picture
answered 3 months ago
  • 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.

profile picture
answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions