Industrial Edge App Development Hints¶
This chapter will give you best practices and advice for your development of Industrial Edge apps.
NOTICE
Always use Docker official or certified images for use in productive environments.
NOTICE
An image should always have a version and clearly defined tags.
NOTICE
Avoid using latest tagged images. It will check for newest release.
NOTICE
Keep your images small by build patterns (e.g. alpine) and install only required/necessary packages.
NOTICE
Divide your app in microservices. One container should only execute one single task.
NOTICE
Use multistage builds to reduce container sizes. Further information can be found here.
NOTICE
Comments on Dockerfile will help to improve understanding. Add an additional maintainer comment for every change in the file.
NOTICE
Only expose ports when it is necessary.
NOTICE
Reduce security risks by not using root user inside of a container. Only let containers run in privileged mode if it is necessary. For more information please see here.
Small Docker images include less packages and other dependencies. This will reduce effort on open source software and license clearing as well as possible bugs and vulnerabilities. It will increase the upload of an app to the Industrial Edge Management as well as the update or deployment on Industrial Edge Devices.
The Industrial Edge uses the native supported restart policies provided by Docker. The restart policies control whether a container start automatically when it exits or when the Industrial Edge Device restarts.
The restart policy options are described in the table below:
Restart option | Description |
---|---|
no | Default behavior. Not automatically restart of container. |
on-failure | Restart the container if it exits due to an error, which manifests as a non-zero exit code. |
always | Always restart the container if it stops. If it is stopped manually, it is restarted only when Docker daemon restarts or the container is manually restarted |
unless-stopped | similar to always, except that when the container is stopped, it is not restarted even after Docker daemon restart. |