Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/egil/iot-edge-device-in-docker

A docker image that enables running the aziot-edge in a docker container.
https://github.com/egil/iot-edge-device-in-docker

azure docker iot-edge

Last synced: about 1 month ago
JSON representation

A docker image that enables running the aziot-edge in a docker container.

Awesome Lists containing this project

README

        

# IoT Edge Device in Docker
A docker image that enables running the aziot-edge 1.5 in a docker container.

## Getting started

To run an IoT Edge device locally, install a compatible Docker runtime, e.g. Docker for Windows.

Then the following is needed:

1. **Create an IoT device identity:**

```shell
az iot hub device-identity create --device-id --hub-name --edge-enabled
az iot hub device-identity connection-string show --device-id --hub-name
```

2. **Start the container:**

```shell
docker run -d --restart unless-stopped --privileged -it -v /var/run/docker.sock:/var/run/docker.sock -v /sys/fs/cgroup:/sys/fs/cgroup:rw -e connectionString='' --hostname=edgedevice1 --name iot-edge-device egilhansen/iothub-edge-device:1.5.7-amd64 --dns 8.8.8.8 --log-driver "json-file" --log-opt "max-file=10" --log-opt "max-size=200k"
```

Or use the following docker-compose (with the edge device connection string replaced):

```yml
services:
iot-edge-device:
image: egilhansen/iothub-edge-device:1.5.7-amd64
restart: unless-stopped
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /sys/fs/cgroup:/sys/fs/cgroup:rw
environment:
- connectionString=""
hostname: edgedevice1
dns: 8.8.8.8
logging:
driver: "json-file"
options:
max-file: "10"
max-size: "200k"
```

And then run: `docker compose up`.

3. **Monitor IoT edge init:**

```shell
docker exec -it iot-edge-device bash

# check init service
journalctl -u iotedge-init.service -f

# check iotedge
iotedge list
iotedge check
```