Search code examples
dockergekkompc

Gekko in a Docker Container


I was interested to know if there is a Gekko container available. Idea is to have a gekko MPC in a docker that can be easily configured with an interface to load a model, do tuning and visualize the results for a realtime application.


Solution

  • Here is a tutorial on how to Dockerize a Python program that is run from a Command Line Interface (CLI). Include gekko in the requirements.txt file. This uses a minimal version of Python that is designed for docker containers.

    FROM python:3.9-slim
    RUN useradd --create-home --shell /bin/bash app_user
    WORKDIR /home/app_user
    COPY requirements.txt ./
    RUN pip install --no-cache-dir -r requirements.txt
    USER app_user
    COPY . .
    CMD ["bash"]
    

    There is also a two part series on how to package applications in a Docker container with Part 1 - Using Docker Desktop and Docker Hub and How to Build and Test Your Docker Images in the Cloud with Docker Hub.

    A few things to consider:

    Every MPC application that I've created is so customized with a particular model for a particular application that it doesn't seem practical to create a general-purpose Docker container. If the application can be developed once and copied to many similar systems (e.g. MPC to replace PID control) then a Docker container may make sense to ease deployment.