Create Docker® image

The Makefile in this example is used to simplify and automate common Docker® tasks. In this way, the Docker® image can be created with the Makefile.

The subfolder tc31-xar-base contains all the necessary files and configurations to create a Docker® image for a TwinCAT 3.1 XAR environment. The purpose of this subfolder is to provide a self-contained build context for creating a Docker® image that can run TwinCAT applications.

Proceed as follows:

1. First add valid myBeckhoff access data in the Linux® system to the configuration file bhf.conf. In this file, replace the placeholders <mybeckhoff-mail> and <mybeckhoff-password> with your login credentials. Do not commit this file with actual login credentials:
./tc31-xar-base/apt-config/bhf.conf
2. Next, build the Docker® image using the Makefile. The package make has already been installed as part of the requirements. Navigate to the example directory and execute the following command:
sudo make build-image

Alternatively, you can also navigate to tc31-xar-base folder of the repository and execute the following command:

sudo docker build --secret id=apt,src=./apt-config/bhf.conf --network host -t tc31-xar-base .

During the image creation process, TwinCAT for Linux® is loaded as a package from https://deb.beckhoff.com.