You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The **createOptions** parameter in the deployment manifest enables you to configure the module containers at runtime. This parameter expands your control over the modules and allows for tasks like allowing or restricting the module's access to the host device's resources, or configuring networking.
21
+
The **createOptions** parameter in the deployment manifest lets you configure the module containers at runtime. This parameter expands your control over the modules and lets you perform tasks like restricting the module's access to the host device's resources or configuring networking.
17
22
18
-
IoT Edge modules are implemented as Docker-compatible containers on your IoT Edge device. Docker offers many options for creating containers, and those options apply to IoT Edge modules, too. For more information, see [Docker container create options](https://docs.docker.com/engine/api/v1.32/#operation/ContainerCreate).
23
+
IoT Edge modules run as Docker-compatible containers on your IoT Edge device. Docker offers many options for creating containers, and those options also apply to IoT Edge modules. For more information, see [Docker container create options](https://docs.docker.com/engine/api/v1.32/#operation/ContainerCreate).
19
24
20
25
## Format create options
21
26
@@ -47,7 +52,7 @@ The IoT Edge deployment manifest accepts create options formatted as JSON. For e
47
52
48
53
This edgeHub example uses the **HostConfig.PortBindings** parameter to map exposed ports on the container to a port on the host device.
49
54
50
-
If you use the [Azure IoT Edge](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-edge) extension for Visual Studio or Visual Studio Code, you can write the create options in JSON format in the **deployment.template.json** file. Then, when you use the extension to build the IoT Edge solution or generate the deployment manifest, it will stringify the JSON for you in the format that the IoT Edge runtime expects. For example:
55
+
If you use the [Azure IoT Edge](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-edge) extension for Visual Studio or Visual Studio Code, write the create options in JSON format in the **deployment.template.json** file. Then, when you use the extension to build the IoT Edge solution or generate the deployment manifest, it stringifies the JSON in the format that the IoT Edge runtime expects. For example:
@@ -56,13 +61,13 @@ If you use the [Azure IoT Edge](https://marketplace.visualstudio.com/items?itemN
56
61
> [!IMPORTANT]
57
62
> The Azure IoT Edge Visual Studio Code extension is in [maintenance mode](https://github.com/microsoft/vscode-azure-iot-edge/issues/639). The *iotedgedev* tool is the recommended tool for developing IoT Edge modules.
58
63
59
-
One tip for writing create options is to use the `docker inspect` command. As part of your development process, run the module locally using `docker run <container name>`. Once you have the module working the way you want it, run `docker inspect <container name>`. This command outputs the module details in JSON format. Find the parameters that you configured, and copy the JSON. For example:
64
+
Use the `docker inspect` command to write create options. Run the module locally using `docker run <container name>` as part of your development process. Once you have the module working the way you want it, run `docker inspect <container name>`. This command outputs the module details in JSON format. Find the parameters you configured and copy the JSON. For example:
60
65
61
-
:::image type="content" source="./media/how-to-use-create-options/docker-inspect-edgehub-inline-and-expanded.png" alt-text="Screenshot of the results of the command docker inspect edgeHub." lightbox="./media/how-to-use-create-options/docker-inspect-edgehub-inline-and-expanded.png":::
66
+
:::image type="content" source="./media/how-to-use-create-options/docker-inspect-edgehub-inline-and-expanded.png" alt-text="Screenshot of the results of the `docker inspect edgeHub` command." lightbox="./media/how-to-use-create-options/docker-inspect-edgehub-inline-and-expanded.png":::
62
67
63
68
## Common scenarios
64
69
65
-
Container create options enable many scenarios, but here are some that come up most often when building IoT Edge solutions:
70
+
Container create options support various scenarios. Here are the most common ones for building IoT Edge solutions:
66
71
67
72
*[Give modules access to host storage](how-to-access-host-storage-from-module.md)
68
73
*[Map host port to module port](#map-host-port-to-module-port)
@@ -74,9 +79,9 @@ Container create options enable many scenarios, but here are some that come up m
74
79
If your module needs to communicate with a service outside of the IoT Edge solution, and isn't using message routing to do so, then you need to map a host port to a module port.
75
80
76
81
>[!TIP]
77
-
>This port mapping is not required for module-to-module communication on the same device. If module A needs to query an API hosted on module B, it can do so without any port mapping. Module B needs to expose a port in its dockerfile, for example:`EXPOSE 8080`. Then module A can query the API using module B's name, for example:`http://ModuleB:8080/api`.
82
+
>Port mapping isn't required for module-to-module communication on the same device. If module A needs to query an API hosted on module B, it can do so without any port mapping. Module B needs to expose a port in its dockerfile. For example,`EXPOSE 8080`. Then, module A can query the API using module B's name. For example,`http://ModuleB:8080/api`.
78
83
79
-
First, make sure that a port inside the module is exposed to listen for connections. You can do this using an [EXPOSE](https://docs.docker.com/engine/reference/builder/#expose) instruction in the dockerfile. For example, `EXPOSE 8080`. The expose instruction defaults to TCP protocol if not specified, or you can specify UDP.
84
+
First, ensure that a port inside the module is exposed to listen for connections. You can do this using an [EXPOSE](https://docs.docker.com/engine/reference/builder/#expose) instruction in the dockerfile. For example, `EXPOSE 8080`. The expose instruction defaults to TCP protocol if not specified, or you can specify UDP.
80
85
81
86
Then, use the **PortBindings** setting in the **HostConfig** group of the [Docker container create options](https://docs.docker.com/engine/api/v1.32/#operation/ContainerCreate) to map the exposed port in the module to a port on the host device. For example, if you exposed port 8080 inside the module and want to map that to port 80 of the host device, the create options in the template.json file would look like the following example:
82
87
@@ -94,15 +99,15 @@ Then, use the **PortBindings** setting in the **HostConfig** group of the [Docke
94
99
}
95
100
```
96
101
97
-
Once stringified for the deployment manifest, the same configuration would look like the following example:
102
+
When stringified for the deployment manifest, the configuration looks like this:
You can declare how much of the host resources a module can use. This control is helpful to ensure that one module can't consume too much memory or CPU usage and prevent other processes from running on the device. You can manage these settings with [Docker container create options](https://docs.docker.com/engine/api/v1.32/#operation/ContainerCreate) in the **HostConfig** group, including:
110
+
Declare how much of the host resources a module can use. This control ensures that one module doesn't consume too much memory or CPU, preventing other processes from running on the device. You can manage these settings with [Docker container create options](https://docs.docker.com/engine/api/v1.32/#operation/ContainerCreate) in the **HostConfig** group, including:
106
111
107
112
***Memory**: Memory limit in bytes. For example, 268435456 bytes = 256 MB.
108
113
***MemorySwap**: Total memory limit (memory + swap). For example, 536870912 bytes = 512 MB.
@@ -134,7 +139,7 @@ If you're running your IoT Edge module on a GPU-optimized virtual machine, you c
0 commit comments