Docker Community Forums

Share and learn in the Docker community.

Remote access of stardog running in docker container

docker

(Larrymartell59) #1

I am new to docker and stardog and I have inherited a set up I have to
now maintain.

Stardog is started in a docker container that is started with this option:

-p 45820:5820

When Stardog is started I see this:

Stardog server is listening on all network interfaces.
SNARL server available at snarl://localhost:5820.
HTTP server available at http://localhost:5820.

It’s running on a headless remote server so I can’t run a local
browser, but if I connect to localhost:45820 with wget I do get a
response that has “Stardog Admin Web Console” so it appears to be
working.

I want to access this remotely. If I try to connect to the machine
with my browser on port 45820 it times out. I can connect to that same
server on other ports we use. I’ve tried opening ports 45820 and 5820
with iptables, but no joy.

I tried to use the docker network command as I saw here:
https://docs.docker.com/engine/userguide/networking/dockernetworks/

But that command doesn’t seem to exist:

$ docker network ls
docker: ‘network’ is not a docker command.

If I run docker inspect I see:

"NetworkSettings": {
    "Bridge": "",
    "PortMapping": null,
    "Ports": {
        "443/tcp": null,
        "5820/tcp": [
            {
                "HostIp": "0.0.0.0",
                "HostPort": "45820"
            }
        ],
        "80/tcp": [
            {
                "HostIp": "127.0.0.1",
                "HostPort": "40180"
            }
        ],
        "8000/tcp": [
            {
                "HostIp": "127.0.0.1",
                "HostPort": "48000"
            }
        ]
    },

And the same ports in the HostConfig section. I’ve tried connecting at
5820, 45820, 40180, 48000, but all NG.

In iptables I see this:

Chain DOCKER (1 references)
target prot opt source destination
ACCEPT tcp – anywhere 172.17.0.1 tcp dpt:irdmi
ACCEPT tcp – anywhere 172.17.0.1 tcp dpt:5820
ACCEPT tcp – anywhere 172.17.0.1 tcp dpt:http
ACCEPT tcp – anywhere 172.17.0.3 tcp dpt:irdmi
ACCEPT tcp – anywhere 172.17.0.3 tcp dpt:5820
ACCEPT tcp – anywhere 172.17.0.3 tcp dpt:http

Anyone know how I can get at this stardog server remotely?


(Jeff Anderson) #2

What happens if you ssh in to this server, and instead of doing your curl test to localhost, use the host’s eth0 address?

If that works, then you can move on and try that same test, but from another host on the same subnet. If that works, then it is likely a firewall between your workstation and the host running docker.


(Larrymartell59) #3

It works from the server running stardog, but it does not work from another host on the same subnet.


(Jeff Anderson) #4

Maybe try running another container and see if the problem persists with that:

docker run -d -p 8989:80 --name test_nginx nginx:alpine

The nginx:alpine image is pretty small and starts up quickly. You can change 8989 to be any other port. Do you have the same problems getting to that port?

This sounds like there’s something going on at your host’s firewall level that is preventing communications. trying another image/port will help you get a sense of what the behavior of your system is. I’d focus effort on looking at your iptables rules for sure.


(Larrymartell59) #5

So the machine got rebooted and after that I was able to connect. Weird.