-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run aziot-edge in a docker container? #7258
Comments
Hey @egil, this is not a use case that we can support. IoT Edge runs as a set of host services, and needs systemd to run. And most likely you won't be able to achieve this, especially if your host does not have systemd. You can try to run the container on Ubuntu or to install systemd within the container itself with dockerfile, but IDK if that will work. The simplest way is to create a VM image instead. I quickly searched online and found something similar - https://askubuntu.com/questions/1471990/add-systemd-to-boot-of-a-docker-container |
Apparently, there was an old issue about that as well - so take a look - #7161 |
Hey @vadim-kovalyov, yes, I know it's not directly supported. I've seen other examples that did this for old versions of the edge device software, and its certainly preferred to having to run a VM in the cloud or locally. I did manage to get it running and the edge device is able to connect to my IoT Hub, but only the agent is getting deployed. There are some warnings if I do an
Here is the command used to build and run the docker container:
Here are the files used to set up the docker container:
|
Hey @egil, glad to see you have the service starting in the container. To answer the question about EdgeAgent I would need to take a look at EdgeAgent logs. Double check that you have a deployment that targets the device. EdgeHub will not start if there has been no deployment applied to the device. Another possibility is that EdgeAgent can't connect to the IoT Hub. This is unlikely, because connectivity checks have passed when you ran |
Guys, I have a proof of concept working as of today (maybe kind of a more edgy approach though)... however, it works for testing on my Mac M3 Pro Relevant additions in
|
Awesome @muelleth. I am using Docker for Windows, will this also work for me? Do prefer to not have privilege mode enabled (I am a docker newbie). @vadim-kovalyov thanks, I am also an iot hub newbie, so I am probably just missing the "edge deployment" @muelleth described above, so that is probably why the edgeClient is not getting pushed to my docker container. |
@vadim-kovalyov I tried creating an deployment using @muelleth deployment file as a template and assigned it to my edge device. It failed to deploy the three images though. Can you guide me to where I need to look for logs you need to help me debug? Appreciate all the help with this! |
@egil remember to put your container registry settings into the json :-)
HTH, THomas |
It did indeed help. Got it running with my dockerfile above. Thanks. Now to develop a few modules 😊 |
I'll close this issue and leave folks with a link to my docker image: |
I am trying to create a docker image that I can use to run a IoT Edge Device in a docker container locally in my computer. But my Linux/docker skills are failing me, so I hope somebody here can help.
My dockerfile looks like this:
The
edge-start.sh
file looks like this:To build the image and run it, I am using the following commands:
The output from running the container in my Docker Windows 4.28.0 on Windows 11 is as follows:
What changes do I need to make to my
dockerfile
,edge-start.sh
, orconfig.toml
to get this working?The text was updated successfully, but these errors were encountered: