How to check the port whether it is listened in another instance

How to check the port whether it is listened in another instance

AuthorFullName__c
Hirofumi Iwashita
articleNumber
000004807
ft:sourceType
Salesforce
FirstPublishedDate
2020-06-10T08:54:31Z
lastModifiedDate
2020-04-27
VersionNumber
3

Artifactory uses Distroless base Docker image from 6.9.1, so it's difficult to check whether Artifactory can communicate with the other instances like the external database.
If PostgreSQL is used as the external database and if PostgreSQL client can be installed in Artifactory instance, the connection confirmation is easy but it shouldn't be installed because of adopting Distroless base Docker image.
For checking whether the port is listened or not, exec command can be used.
For example, the IP address is 172.19.0.2 and the PORT is 5432 for PostgreSQL, the following statement is enable.

# exec 3<> /dev/tcp/172.19.0.2/5432
*"3" means the file descriptor 3 is used. 0, 1 and 2 shouldn't be specified because they are stdin, stdout and stderr.

The last line is added and we can see the connection is established
# netstat -an | grep 5432          
tcp        0      0 172.19.0.3:34916        172.19.0.2:5432         ESTABLISHED
tcp        0      0 172.19.0.3:34948        172.19.0.2:5432         ESTABLISHED
tcp        0      0 172.19.0.3:35178        172.19.0.2:5432         ESTABLISHED
tcp        0      0 172.19.0.3:34944        172.19.0.2:5432         ESTABLISHED
The following command can be used for closing the opened file descriptor 3.
# exec 3>&-