Sample Header Ad - 728x90

Can't log into Oracle 19c database running inside a container from the host

1 vote
1 answer
938 views
I have a server running Oracle 19c inside a Docker container, and I would like the ability to log into the database from the host using sqlplus. Inside the container, I am able to run this command successfully: sqlplus john/john@127.0.0.1:1521/XYZ However, when ran from outside the container, the command hangs for ~60 seconds then fails and returns this error: ORA-12637: Packet receive failed **How can I log into the database from the host?** docker-compose.yml:
version: '3.8'
name: db
services:
  database:
    image: doctorkirk/oracle-19c:19.3
    volumes:
      - ~/oracle19c/data/:/opt/oracle/oradata
    ports:
      - 1521:1521
    environment:
      - ORACLE_SID=XYZ
      - ORACLE_PWD=oracle
docker ps:
user@test-db:~$ docker ps
CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS                    PORTS                                       NAMES
29ba3a2ebe95   doctorkirk/oracle-19c:19.3   "/bin/sh -c 'exec $O…"   16 minutes ago   Up 15 minutes (healthy)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp   db-database-1
listener.ora:
LISTENER =
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
  )
)

DEDICATED_THROUGH_BROKER_LISTENER=ON
DIAG_ADR_ENABLED = off
netstat -tulpn from inside the container:
[oracle@29ba3a2ebe95 ~]$ netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN      17/tnslsnr
tcp        0      0 127.0.0.11:34963        0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:34633           0.0.0.0:*               LISTEN      88/ora_d000_XYZ
udp        0      0 127.0.0.11:37794        0.0.0.0:*                           -
udp        0      0 127.0.0.1:54395         0.0.0.0:*                           90/ora_s000_XYZ
udp        0      0 127.0.0.1:38515         0.0.0.0:*                           88/ora_d000_XYZ
udp        0      0 127.0.0.1:52421         0.0.0.0:*                           76/ora_lreg_XYZ
netstat -tulpn from the host:
user@test-db:~$ netstat -tulpn
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::1521                 :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
Asked by slightly_toasted (121 rep)
Mar 23, 2023, 07:17 PM
Last activity: Jun 11, 2024, 05:03 PM