Unable to connect to oracle DB outside container


I am unable to connect to oracle database which is running inside container.

getting below error while connecting from outside of the container :

Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection (CONNECTION_ID=94caowUqRYyLfnQKu/tAig==)

Could someone please help me

Hi. To help you, we need some more information. Please, if it is possible, share the below details if any of those are missing from your original post unless you are absolutely sure it is not relevant:

  • Host operating system
  • Docker version
  • Docker Desktop version (if it is Docker Desktop)
  • How you installed Docker (with a link if there is one)
  • Error messages
  • Commands that you ran before you get the error messages, so we know what gave you those messages.
  • How you configured your container or image (parameters without secret data)
  • docker compose file
  • Dockerfile

Remove any secret data before sharing and use the code block button (</>) to insert codes, terminal outputs or error messages.

Thank you for helping us to help you :slight_smile:

Host operating system - Oracle Linux Server 7.6
docker version - 19.03.11-ol
How you installed Docker - i have installed using yum install utility
Error - PFB. This error comes while i try to connect from sql developer.
Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection (CONNECTION_ID=94caowUqRYyLfnQKu/tAig==)
Commands that you ran before you get the error messages, so we know what gave you those messages. —> I have migrated this container from one host to another. Post migration on new server, connection not working outside container.
How you configured your container or image (parameters without secret data) → I have configured with very minimum parameters like -p 1521:1521 (port) -v volume name.
Have not used docker compose or dockerfile.

First of all, when we ask questions to understand your situation better, please, be as specific and detailed as you can. Don’t choose to write quick and short answers without formatting (I can barely see the answers among my questions in your post), because we don’t know what you know so the short answers may be clear to you, but not to us. This is one of the reason why I also asked you to share links to the installation guide you followed. But I guess it was something like this: https://blogs.oracle.com/virtualization/post/install-docker-on-oracle-linux-7
You also ignored my request to use the code block button, but in this case it is not a big problem, it just could be.

I try to answer based on what you shared.

Oracle Linux is not directly supported by Docker. It does not mean we won’t help, but we can’t guarantee that our suggestions will work on a system we don’t know and the Documentation of Docker does not mention it.

How did you do that? You should not export containers and import them on an other host. The recommended way is to properly backup the databases and any data, then starting a completely new container on an other host where you can import the data the way that the actual Database server supports. You could also stop the container on the source host, and copy the content of the volume or host folder that you mounted into the container, but then you need to be careful with permissions and symbolic links or any special files.

Since you write you cant access the database from SQL developer, have you tried to access from command line from the oracle database container? Are you sure the container is running properly?

Hello Rimelek,

Extremely sorry for not giving your answers correctly.
However, i am very new in docker and trying to learn things in it.

I dont know what code block button is and where is find and what to upload in it. sorry for that.

As mentioned by you, i have installed link this way mentioned in below website.

I am able to connect to the database from container but its not accessible only from outside.
Even i have check port is open or not and that was open. i tried to use diff port to access but that too not worked.

Hope this helps you. Let me know you need any more information.

Thanks for your reply.

As about 90% of people on this forum I guess :slight_smile: That is not a problem at all. But if you can’t explain what your problem is, we can’t help. I am trying to understand, but I have to say, it is not easy. Since I had more questions that you answered, I really think it would be better if you could share commands and the output of the commands to show us what worked and what did not. Please, read carefully. If you don’t understand a question or an expression, feel free to ask us to describe it an other way.

I have quoted the the shape of tha button bbetween parenthesis:

It is above the text area where you write your message. paste the code, select that code in the textarea with your mouse and click on the button I mentioned. Or just used the below syntax in your message as you would on GitHub if you know that.

type or paste your code here  

This is markdown. You can read about it here: Fenced Code Blocks

Now please, try to answer the question that you have not answered yet:

        "Id": "44634d09245e95d43888600549aae07618238541aad04cf722b9d9b342dd93d2",
        "Created": "2022-08-01T05:28:07.221652258Z",
        "Path": "/bin/bash",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 26308,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2022-08-01T05:28:07.785890088Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        "Image": "sha256:77429684d2c379856491750c220550201705d41bfc5ba535280790e868ba7130",
        "ResolvConfPath": "/var/lib/docker/containers/44634d09245e95d43888600549aae07618238541aad04cf722b9d9b342dd93d2/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/44634d09245e95d43888600549aae07618238541aad04cf722b9d9b342dd93d2/hostname",
        "HostsPath": "/var/lib/docker/containers/44634d09245e95d43888600549aae07618238541aad04cf722b9d9b342dd93d2/hosts",
        "LogPath": "/var/lib/docker/containers/44634d09245e95d43888600549aae07618238541aad04cf722b9d9b342dd93d2/44634d09245e95d43888600549aae07618238541aad04cf722b9d9b342dd93d2-json.log",
        "Name": "/database",
        "RestartCount": 0,
        "Driver": "btrfs",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": [
        "HostConfig": {
            "Binds": [
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            "NetworkMode": "default",
            "PortBindings": {
                "1524/tcp": [
                        "HostIp": "",
                        "HostPort": "1524"
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Capabilities": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
            "ReadonlyPaths": [
        "GraphDriver": {
            "Data": null,
            "Name": "btrfs"
        "Mounts": [
                "Type": "bind",
                "Source": "/scratch",
                "Destination": "/FS",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
                "Type": "volume",
                "Name": "cf1b96164f34934f49878094b8ef00ab41cb016166370fad871c536081f7a6dc",
                "Source": "/var/lib/docker/volumes/cf1b96164f34934f49878094b8ef00ab41cb016166370fad871c536081f7a6dc/_data",
                "Destination": "/scratch:/scratch",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
        "Config": {
            "Hostname": "*********",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "1524/tcp": {}
            "Tty": true,
            "OpenStdin": true,
            "StdinOnce": false,
            "Env": [
            "Cmd": [
            "Image": "database",
            "Volumes": {
                "/scratch:/scratch": {}
            "WorkingDir": "/scratch",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "40aed88440e073d5b16196435b7c769513675922729d8008ba0c1ff23bfb1b47",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "1524/tcp": [
                        "HostIp": "",
                        "HostPort": "1524"
            "SandboxKey": "/var/run/docker/netns/********",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "42a3a595a1b37b3a3e35af980382acf345cfa20801e3dd58f6a46f3498134ca4",
            "Gateway": "******",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "*******",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "********",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "084c28c953603985968f5bcc0491a538c21b5cd9daffaeeffc647387db157294",
                    "EndpointID": "42a3a595a1b37b3a3e35af980382acf345cfa20801e3dd58f6a46f3498134ca4",
                    "Gateway": "********",
                    "IPAddress": "*********",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "*******",
                    "DriverOpts": null

I had stop DB and container then i copied database files from source to target server. Then i took container image backup and took tar out of it.
Transferred that tar to target server. Restore image from it and then created a container with -p and -v option. then i started database and listener.
I was able to access db from inside container but was not accessible from outside of the container.

It is hard to help you when you keep describing what you did without sharing commands with which you did that. You shared a json output, but you did not tell us what it was, so we need to figure it out… We can usually recognize outputs like that, but it really makes the communication slower and harder.

So I guess that was the result of docker inspect CONTAINERNAME, but you removed the network related parts like gateway and ip address whcih could have helped.

In the above json, it looks like you bind mount /scratch from the host into the container at /FS. I have no idea what it is, but if it is not on your new host, the container will probably not work. And the other strange part of that json is that you also have an anonymous volume mounted to /scratch:/scratch in the container which does not make sense to me.

Since you don’t share commands and how you originally created that container, I think this is all I can help. You really should not copy containers from one host to an other and you should always have at least a script with the docker run command, but much better to use docker compose with a yaml file where you describe how that container should start.