Dockerize the EdgeApp

Hi Karolina,

OpenEMS is used widely in Docker containers, e.g. our Gitpod Live-Demo is powered by Docker (see the Gitpod specific Docker configuration here: openems/.gitpod.Dockerfile at develop · OpenEMS/openems · GitHub). Unfortunately there is no ‘standard’ Docker container available yet.

You can build your own dockerized OpenEMS Edge using the following Linux commands:

  • Create a working directory and change to it
mkdir openems-edge
cd openems-edge
  • Create subdirectories for configuration files and storage data
mkdir -p config data`
  • Create a Dockerfile:
cat <<EOF > Dockerfile
FROM eclipse-temurin:11-jre-alpine
RUN mkdir /opt/openems-edge
COPY openems-edge.jar /opt/openems-edge
CMD ["java", "-jar", "", "", "/opt/openems-edge/openems-edge.jar"]
  • Provide a openems-edge.jar file in the current directory. For example this command downloads the latest artifact from the latest GitHub Release version:
curl -s | awk -F\" '/browser_download_url.*openems-edge\.jar/{print $(NF-1)}' | xargs wget -O openems-edge.jar
  • Build the Docker Image in the current directory
docker build -t openems-edge .
  • Run the Docker Container
docker run --volume=$(pwd)/config:/etc/openems.d --volume=$(pwd)/data:/var/lib/openems --publish=8080:8080 openems-edge

I am by far no expert in Docker, so if there is anything incomplete or wrong with this guide, please provide feedback. Also I believe it might be a good idea to build official docker images in future via GitHub Actions, just like we create Release artifacts.


1 Like