orientechnologies / orientdb-docker

OrientDB running in a docker container
MIT License
63 stars 63 forks source link

ERR_CONNECTION_RESET when connect to http://localhost:2480 #12

Closed leosuncin closed 8 years ago

leosuncin commented 8 years ago

I runned OrientDB container:

docker run -d --name orientdb-dev -p 2424:2424 -p 2480:2480 -v ~/dv/orientdb/config:/orientdb/config -v ~/dv/orientdb/databases:/orientdb/databases -v ~/dv/orientdb/backup:/orientdb/backup -e ORIENTDB_ROOT_PASSWORD=mypassword orientdb:2.2.0

And when I open http://localhost:2480 in Google Chrome, cann't connect due ERR_CONNECTION_RESET

docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                   PORTS                                            NAMES
d170d05a4711        orientdb:2.2.0      "server.sh"              31 minutes ago      Up 31 minutes            0.0.0.0:2424->2424/tcp, 0.0.0.0:2480->2480/tcp   orientdb-dev

I don't know if I have to edit orientdb-server-config.xml to allow a direct connection, if that the case please add to documentation

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<orient-server>
    <network>
        <protocols>
            <protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/>
        </protocols>
        <listeners>
            <listener protocol="binary" socket="default" port-range="2424-2430" ip-address="127.0.0.1"/>
        </listeners>
    </network>
    <storages/>
    <users>
        <user resources="*" password="mypassword_encrypted" name="root"/>
        <user resources="connect,server.listDatabases,server.dblist" password="guestpassword_encrypted" name="guest"/>
    </users>
    <security>
        <users/>
        <resources/>
    </security>
    <isAfterFirstTime>true</isAfterFirstTime>
</orient-server>
robfrank commented 8 years ago

Hi, as far i understand, you provide to orient your own config file to override the one delivered inside the container.

        <listener protocol="binary" socket="default" port-range="2424-2430" ip-address="127.0.0.1"/>

this bind the protocol to 127.0.0.1 INSIDE the container and, of course, it only configure the binary protocol switching off http.

So, can you try with:

docker run -d --name orientdb-dev -p 2424:2424 -p 2480:2480  -v ~/dv/orientdb/databases:/orientdb/databases -v ~/dv/orientdb/backup:/orientdb/backup -e ORIENTDB_ROOT_PASSWORD=mypassword orientdb:2.2.0

Moreover, 2.2.3 is available.

leosuncin commented 8 years ago

I didn't edit orientdb-server-config.xml, is The default config created after docker run, I just replaced hash password

robfrank commented 8 years ago

cab you try to run the container WITHOUT the config volume. You should provide the config volume ONLY in case you have your own config set: server config, jsons, logs. For example, if you have config files managed by a configuration management software (puppet, chef, ansible...), you will provide a volume with these files.

robfrank commented 8 years ago

any news? did you manage your issues? may I close the issue?

leosuncin commented 8 years ago

When run the container without volumens, if the same error cann't connect to port 2480

docker run -d -p 2424:2424 -p 2480:2480 -e ORIENTDB_ROOT_PASSWORD=mypassword orientdb:2.2.0
leosuncin commented 8 years ago

The ports on container are open and listening, the problem will be orientdb's default configuration.

docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
3b08c1beb04c        orientdb:2.2.0      "server.sh"              7 minutes ago       Up 7 minutes        0.0.0.0:2424->2424/tcp, 0.0.0.0:2480->2480/tcp   mad_meninsky

docker exec 3b08c1beb04c sh

netstat -tuplen # inside running container
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 :::2480                 :::*                    LISTEN      1/java
tcp        0      0 :::2424                 :::*                    LISTEN      1/java
robfrank commented 8 years ago

The config inside the container is the same as the one inside the tar.gz, e.g.:

https://github.com/orientechnologies/orientdb/blob/master/graphdb/config/orientdb-server-config.xml

I don't know which is the host OS for docker engine, but if you're on mac or windows (docket toolbox) remember that docker run inside a VM (docker-machine) and you will find orient on 2480 of the Vm's ip.

leosuncin commented 8 years ago

I tested a lot switches when execute docker run and finally works:

docker run -d --name orientdb-dev -p 2424:2424 -p 2480:2480 -v ~/dv/orientdb/databases:/orientdb/databases -e ORIENTDB_ROOT_PASSWORD=mypassword orientdb:2.2.0

I don't know why but when set a local config volume, orientdb-server-config.xml is set with basic values

Docker version 1.11.2, build b9f10c9 ArchLinux 4.4.13-1-MANJARO

robfrank commented 8 years ago

I try to be more clear. A volume is useful for 2 main cases: provide disk space where a container can store data, such as database files, or to provide configurations. If you provide an empty config volume, OrientDB will start without a configuration set: the configurations files INSIDE the container are not loaded, because the /config directory is completely overridden by the external volume. BUT the external volume is empty, there's nothing to read. So OrientDB will start with the MINIMAL configuration AND will persists it to the volume. So the config files you find on the volume IS the mininal OrientDB's configuration persisted. Docker' volumes are, IMHO, one of the powerful and yet confusing part of docker itself. Bear in mind that by default containers are ephemeral, they are not VMs.