--publish 7080:7080
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).
Sourcegraph is now running at http://localhost:7080
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:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
687f9749d99c sourcegraph/server:2.3.11 "/sbin/tini -- /usr/…" 43 minutes ago Up 43 minutes keen_torvalds
...
$ docker run -it --rm --net container:687f9749d99c nicolaka/netshoot /bin/sh
/ # netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5005 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3700 0.0.0.0:* LISTEN
tcp 0 0 :::7080 :::* LISTEN
tcp 0 0 :::3178 :::* LISTEN
tcp 0 0 :::3179 :::* LISTEN
tcp 0 0 :::6379 :::* LISTEN
tcp 0 0 :::6060 :::* LISTEN
tcp 0 0 :::3180 :::* LISTEN
tcp 0 0 :::3181 :::* LISTEN
tcp 0 0 :::3090 :::* LISTEN
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.