How can create a connection between a container and other system

Is that possible to set IP address on container or not ?
for example I have a database on a physical server with ip =
and my application is on a container now want to know how can create a connection between them ?
I want to know what is the canonical way for do this ?

While plain docker containers can have a fixed ip, swarm services can not.
For container to container commmunication in a docker network, it is recommended to use the (service) name, as the ip can change unless it’s fixed. The docker network internal dns service will take care of the name resolution.

For outside to container communication, it is recommended to publish ports and use the host’s hostname or ip to access the container using the host side of the published port.

For container to outside communication, you can communicate to the outside ip. On Linux systems the resolv.conf of the docker host is injected into the containers. As long as one of the listed dns servers is able to resolve the hostname or fqdn of the outside host, you can use them as well.

can I directly connect via ssh to my containers ? or first had to connect to docker and via that create connection to containers ?

I am not sure how ssh access is related to your original question…
Why would you want to access the shell of the container?!

The recommende way is to use images that allow environment specific configuration using environment variables in combination with an entrypoint script that makes use of them to modify the configuration files accordingly. Worst case: build your own image that does what you need.

A docker container is NOT a vm - it does not run a full os with all bells and whisles. Though it usualy includes the important binaries and their dependencies that make up the os, except there is no system daemon that starts any services. Whatever you define as the entrypoint script or command is what gets executed - not more, not less.