Docker to Docker Oracle 12c Connection
Make sure DB is up and running with status healthy 

docker container ps

Make sure Oracle instant client is installed on host if trying to connect from host to containers  via sqlplus or any 3rd party gui tools and set up connections in tnsnames.ora on host 


3̶. S̶e̶t̶ ̶u̶p̶ ̶c̶o̶n̶n̶e̶c̶t̶i̶o̶n̶s̶ ̶i̶n̶ ̶t̶n̶s̶n̶a̶m̶e̶s̶.̶o̶r̶a̶ ̶o̶n̶ ̶b̶o̶t̶h̶ ̶c̶o̶n̶t̶a̶i̶n̶e̶r̶s̶.̶   (skip this step)


Make sure Oracle listener is up and running and you can find out services names on each containers by running the command

lsnrctl status 

You need to find out mapped ports. Execute command

docker port orcl


From my container the output is:

$ docker port orcl
1521/tcp -&gt; 0.0.0.0:32769
5500/tcp -&gt; 0.0.0.0:32768

You can connect directly from sqldeveloper or setup tns entries in tnsnames.ora for sqlplus client.

Here is the screenshot connecting from sqldeveloper
   

For sqlplus client on host

#tnsname entry for container 1
orclcdb =
(DESCRIPTION =
  # host ipaddress and mapped port for 1521 is 32769
 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.101)(PORT = 32769))
 (CONNECT_DATA =
(SERVER = DEDICATED)
#service name from lsnrctl status command
(SERVICE_NAME = ORCLCDB.localdomain)
)
)

Verify tnsname entries with the command from host:

tnsping  orclcdb



Note

My setup was on Windows 10(host) and docker running on VM. I executed the following command to find the ipaddress of docker VM

Input:

docker-machine ls


Output:





Correction: 

I didn't notice parameter -p 1521:1521 for the container start up command. That parameter exposes port 1521 for public. Just use container ipaddress(from docker-machine ls) and same port 1521 for sqlplus client connection from the host.