I am trying to run sourcegraph service on a remote machine. The instructions to run sourcegraph is given as
https://about.sourcegraph.com/docs/server
docker run \
--publish 7080:7080 --rm \
--volume /tmp/sourcegraph/config:/etc/sourcegraph \
--volume /tmp/sourcegraph/data:/var/opt/sourcegraph \
sourcegraph/server:2.3.11
This runs sourcegraph at 127.0.0.1
I want to run at 0.0.0.0
so that I can access the service from remote machines.
Trying this doesn't work.
docker run --publish 0.0.0.0:7080:7080 ...
It says, it is running the service on
Sourcegraph is now running at http://localhost:7080
Any suggestions? Could this be sourcegraph's problem?
That option causes docker to listen on all host interfaces and forward traffic from host port 7080 to the container's port 7080. The container must be listening on all interfaces inside its network namespace for this to work (docker cannot talk to the loopback interface inside the container's network namespace).
This is actually a misleading message from your application (this doesn't come from docker itself). Testing this image with netshoot shows that the container is listening on all interfaces:
Note the
:::7080
line shows the container is listening for this port on all interfaces. As long as your network allows it, you should be able to reach your container by going the host IP, port 7080.