The --link argument is a legacy feature and it’s generally recommended to use user-defined networks for container communication in Docker. The --link flag might cause issues because it’s deprecated and may not work as expected with newer versions of Docker.
Create a User-Defined Network, Connect Your Containers to the Network For the containers that you want to communicate with each other, make sure to connect them to the network you’ve created.
docker run --name kafka -d --network mynetwork kafka-image
docker run --name dbz_oracle21 -d --network mynetwork oracle-image
Now, when you run your application container, you don’t need to use the --link argument.
By using a user-defined network, your containers can communicate with each other using their container names as hostnames. This method is more robust and flexible compared to the old --link approach.
Remember to replace kafka-image and oracle-image with the actual images you are using for Kafka and Oracle DB. Also, ensure that your Oracle DB and Kafka are configured to accept connections from the Docker network.