Docker®
Installation of Docker® on TwinCAT Runtime Linux®
- Connect to the PackageManager of TwinCAT Runtime Linux® to install the corresponding package.
- 1. Update the packages.
sudo apt update- 2. Install the official GPG key from Docker®.
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc- 3. Add the Docker® repository.
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null- 4. Update the packages.
sudo apt update- 5. Install the Docker® package.
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin- 6. Check whether Docker® has been started successfully.
sudo systemctl status docker- 7. Start Docker® if it is not already running.
- Docker® has been successfully installed.
sudo systemctl start dockerCreating the YAML file
- 1. Create a new folder structure in the Home folder.
mkdir -p docker/postgresql17timescaledb docker/pgadmin- 2. Create a YAML file for Postgres.
echo "# Datei: /home/Administrator/docker/postgresql17timescaledb/compose.yaml
services:
postgrestimescale17:
image: timescale/timescaledb:latest-pg17
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: 1
POSTGRES_DB: historize_postgres
volumes:
- pgdata17timescale:/var/lib/postgresql/data
networks:
- pgNetwork
volumes:
pgdata17timescale:
name: pgdata17timescale
networks:
pgNetwork:
name: pgNetwork" > /home/Administrator/docker/postgresql17timescaledb/compose.yaml- 3. If you want to access your database using a UI, also create a YAML file for pgAdmin
echo "# Datei: /home/Administrator/docker/pgadmin/compose.yaml
services:
pgadmin:
image: dpage/pgadmin4
ports:
- 5050:80
restart: always
volumes:
- pgadmindata:/var/lib/pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: Default@beckhoff.com
PGADMIN_DEFAULT_PASSWORD: 1
networks:
- pgNetwork
volumes:
pgadmindata:
name: pgadmindata
networks:
pgNetwork:
name: pgNetwork" > /home/Administrator/docker/pgadmin/compose.yaml- 4. Once you have created a YAML file for PostgreSQL and pgAdmin, create another file to address both files centrally.
echo "# Datei: /home/Administrator/docker/compose.yaml
include:
- postgresql17timescaledb/compose.yaml
- pgadmin/compose.yaml" > /home/Administrator/docker/compose.yaml- 5. Now switch to the Docker® folder if you have created all YAML files. If you have only created the PostgreSQL YAML file, please go to the folder ""
cd /home/Administrator/docker/- 6. Create Docker® containers and start them directly.
- The Docker® containers were successfully created and started.
sudo docker compose up -dFirewall settings
- 1. Create a configuration file in the directory /etc/nftables.conf.d/, for example with the name 00-postgreDocker.conf
sudo nano /etc/nftables.conf.d/00-postgreDocker.conf- 2. Insert the following content and adjust the values to your network requirements:
table inet filter {
chain input {
# accept PostgresSQL
tcp dport 5432 accept
}
chain input {
# accept pgAdmin
tcp dport 5050 accept
}
}- 3. Save and close the configuration file.
- 4. Load the new rule with the command
sudo systemctl reload nftables- 5. Check the settings and make sure that the configuration has been applied correctly.
- Port 5432 and 5050 have been enabled for PostgreSQL.
sudo nft list rulesetConnect pgAdmin to the database.
- 1. Connect to the online interface of pgAdmin.
http://<IP-Adresse>:5050/- 2. Log in with the login data from docker/pgadmin/compose.yaml.
PGADMIN_DEFAULT_EMAIL: Default@beckhoff.com
PGADMIN_DEFAULT_PASSWORD: 1 - 3. Right-click the server.
- 4. Select Register/Server... from the context menu.
- 5. Enter the display name of the PostgreSQL database as the name.
- 6. Switch to the Connection tab.
- 7. Enter the IP of your system under Host name/address to communicate with the database.
- 8. Enter "postgres" as the Username.
- 9. Enter the password set in docker/postgresql17/compose.yaml as Password.
POSTGRES_PASSWORD: 1
- The connection to the database has been successfully established. You can now manage your database using pgAdmin.