Microservice: CODESYS Linux Runtime & CODESYS Edge Gateway¶
The following section describes how to integrate a containerized CODESYS SoftPLC. These instructions assume an existing ECI installation, familiarity with building Docker containers and running the CODESYS Software PLC.
The following section is applicable to:

Prerequisites: CODESYS Containers¶
Download the CODESYS Control for Linux SL package (
CODESYS Control for Linux SL x.x.x.x.package
) from the following website:For US based customers: https://us.store.codesys.com/codesys-control-for-linux-sl-bundle.html
For non-US based customers: https://store.codesys.com/codesys-control-for-linux-sl-bundle.html
Optional: If desired, download the CODESYS Edge Gateway for Linux package (
CODESYS Edge Gatway for Linux x.x.x.x.package
) from the following website:Note
There is an option to skip building the CODESYS Edge Gateway for Linux microservice, as such, this step is optional.
For US based customers: https://us.store.codesys.com/codesys-edge-gateway-for-linux.html
For non-US based customers: https://store.codesys.com/codesys-edge-gateway-for-linux.html
Building: CODESYS Containers¶
The following steps detail how to build Docker images which contain CODESYS components.
If not already completed, follow section Prepare the Build System for Microservices to prepare the build system.
Open a terminal on the build system and navigate to the extracted
Dockerfiles
directory. The contents of this directory should be as follows:$ ls application-containers bpf display-containers softplc-containers
Navigate to the
softplc-containers
directory. The contents of this directory should be as follows:$ ls build.sh codesys-control codesys-control-apploader codesys-edge-gateway codesys_packages README.md
Copy
CODESYS Control for Linux SL x.x.x.x.package
downloaded earlier into thecodesys_packages
directory.Optional: Copy
CODESYS Edge Gatway for Linux x.x.x.x.package
downloaded earlier into thecodesys_packages
directory.Execute the
build.sh
script located in this directory to build the CODESYS Docker images:/bin/bash build.sh
After the build has completed successfully, there will be Docker images that have generated and tarballed. Each of them vary:
Docker Image archive name
Description of Docker Image
codesys-control.tar
Docker image which contains only the CODESYS runtime.
codesys-control-apploader.tar
Docker image which contains the CODESYS runtime as well as functionality to run a CODESYS workload.
codesys-edge-gateway.tar
Docker image which contains the CODESYS Edge Gateway.
Executing: CODESYS Linux Runtime Containers¶
The following section is applicable to:

Ensure that the Docker daemon is active. Run the following command to restart the Docker daemon.
Warning
All running Docker containers will also restart.
$ systemctl restart docker
The status of the Docker daemon can be verified with the following command:
$ systemctl status docker
Copy the Docker images created earlier to the target system.
Load the copied Docker images by performing the following commands:
$ docker load < codesys-control.tar $ docker load < codesys-control-apploader.tar
Check which Docker images are present on the target system with the following command:
$ docker images
The CODESYS images that were loaded should be present in the list. Note the names and tags of these images for use in the following steps.
For example, on your system the output is as follows:
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE codesys-control-apploader v1.5 c2a503766b98 2 minutes ago 207MB codesys-control v1.5 959056a52734 2 minutes ago 201MB
Start the container with the following command, where
<container>
and<tag>
correspond to the values on the target system:$ docker run --cap-add=SYS_PTRACE --network host <container>:<tag>
For example, on our system we start the codesys-control container:
$ docker run --cap-add=SYS_PTRACE --network host codesys-control:v1.5
Executing: CODESYS Edge Gateway Container¶
The following section is applicable to:

Ensure that the Docker daemon is active. Run the following command to restart the Docker daemon.
Warning
All running Docker containers will also restart.
$ systemctl restart docker
The status of the Docker daemon can be verified with the following command:
$ systemctl status docker
Copy the Docker image created earlier to the target system.
Load the copied Docker image by performing the following command:
$ docker load < codesys-edge-gateway.tar
Check which Docker images are present on the target system with the following command:
$ docker images
The CODESYS image loaded earlier should be present in the list. Note the name and tag of the image for use in the following steps.
For example, on our system the output is as follows:
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE codesys-edge-gateway v1.5 7b651e1bc6f2 About a minute ago 142MB
This step is optional. To run the CODESYS Edge Gateway in a separate Docker network called
codesys
, create it first by performing the following command:$ docker network create codesys
The CODESYS Edge Gateway must be reachable from external host over the port
tcp/1217
, hence the parameter-p 1217:1217
is necessary. Start the CODESYS Edge Gateway container by performing the following command:$ docker run -d --rm \ --name codesys-edge-gateway \ --hostname docker-edge-gateway \ -p 1217:1217 \ codesys-edge-gateway
Note: If a Docker network had been created earlier, add the parameter
--network codesys
to connect the container to this network:$ docker run -d --rm \ --name codesys-edge-gateway \ --hostname docker-edge-gateway \ --network codesys \ -p 1217:1217 \ codesys-edge-gateway
It is possible to view all the active CODESYS runtimes on the Docker network using the CODESYS IDE. Refer to section CODESYS IDE Installation for installing the CODESYS IDE.
The following section is applicable to:
Using the CODESYS IDE, connect to the CODESYS Edge Gateway by using the target system IP address and standard port
1217
. If any CODESYS runtimes are active on the same Docker network, they will be visible when performing a network scan.