Microservice: CODESYS Linux Runtime and CODESYS Edge Gateway¶
The following section describes the procedure to integrate a containerized CODESYS* SoftPLC. These instructions assume that you have an existing ECI installation and you are familiar with building Docker containers and running the CODESYS Software PLC.
The following section is applicable to:

CODESYS Containers: Prerequisites¶
Download the CODESYS Control for Linux SL package (
CODESYS Control for Linux SL x.x.x.x.package
) from the following website:Important
Only CODESYS Control for Linux SL versions 3.5.16.20 and older, or 4.5.0.0 and newer are compatible with container environments. Versions 4.0.x.x - 4.4.x.x do not work in a container correctly!
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: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
Note: There is an option to skip building the CODESYS Edge Gateway for Linux microservice, and this step is optional.
Build CODESYS Containers¶
Do the following to build Docker* images that contain CODESYS components:
If not already completed, prepare the build system.
Open a terminal on the build system and navigate to the extracted
Dockerfiles
directory. This directory should contain the following:$ ls application-containers bpf display-containers softplc-containers
Navigate to the
softplc-containers
directory. This directory should contain the following:$ ls build.sh codesys-control codesys-control-apploader codesys-edge-gateway codesys_packages README.md
Copy the downloaded
CODESYS Control for Linux SL x.x.x.x.package
package to thecodesys_packages
directory.Optional: Copy the downloaded
CODESYS Edge Gatway for Linux x.x.x.x.package
package to thecodesys_packages
directory.Run the
build.sh
script, located in this directory, to build the CODESYS Docker images:/bin/bash build.sh
After the build has completed successfully, Docker images would have been generated and tarballed. Each of them vary:
Docker Image Archive Name
Description of Docker Image
codesys-control.tar
Contains only the CODESYS runtime
codesys-control-apploader.tar
Contains the CODESYS runtime and the functionality to run a CODESYS workload
codesys-edge-gateway.tar
Contains the CODESYS Edge Gateway
Execute CODESYS Linux Runtime Containers¶
The following section is applicable to:

Install Docker if not already done.
Ensure that the Docker daemon is active. Run the following command to restart the Docker daemon:
Warning: All Docker containers that are currently running will also restart.
$ systemctl restart docker
Verify the status of the Docker daemon:
$ systemctl status docker
Copy the Docker images, created earlier, to the target system.
Load the copied Docker image:
$ docker load < codesys-control.tar $ docker load < codesys-control-apploader.tar
Check the Docker images that are present on the target system:
$ docker images
The CODESYS images that were loaded should be present in the list. Note down the names and tags of these images.
Here is a sample output:
$ 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. Note that
<container>
and<tag>
correspond to the values on the target system:$ docker run --cap-add=SYS_PTRACE --network host <container>:<tag>
For example, here is the command to start the
codesys-control
container:$ docker run --cap-add=SYS_PTRACE --network host codesys-control:v1.5
Execute CODESYS Edge Gateway Container¶
The following section is applicable to:

Install Docker if not already done.
Ensure that the Docker daemon is active. Restart the Docker daemon:
Warning: All running Docker containers will also restart.
$ systemctl restart docker
Verify the status of the Docker daemon:
$ systemctl status docker
Copy the Docker image, created earlier, to the target system.
Load the copied Docker images:
$ docker load < codesys-edge-gateway.tar
Check the Docker images that are present on the target system:
$ docker images
The CODESYS image loaded earlier should be present in the list. Note down the names and tags of these images.
Here is a sample output:
$ 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
, run the following command to create the network:$ 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. Run the following commands to start the CODESYS Edge Gateway container:$ 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
You can view all active CODESYS runtimes on the Docker network using the CODESYS IDE. Refer to Install CODESYS IDE for installing the CODESYS IDE.
The following section is applicable to:
With the CODESYS IDE, connect to the CODESYS Edge Gateway using the IP address of the target system and standard port
1217
. Any CODESYS runtimes active on the same Docker network will be displayed during a network scan.