Getting Data In

Trying to access the rest api using the Splunk Docker image

kwitczak
New Member

I followed the steps on this site https://hub.docker.com/r/splunk/splunk/ and successfully started my docker container with Splunk running. I can get to Splunk via http://localhost:8000/ and login but I am unable to access the rest api using http://localhost:8089/. I just get this in the browser:

This site can’t be reached
localhost refused to connect.

Any ideas?

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi @kwitczak,

In your docker command, you have just mapped 8000 port.

docker run -d -e "SPLUNK_START_ARGS=--accept-license" -e "SPLUNK_USER=root" -p "8000:8000" splunk/splunk

For accessing management port you have to map 8089 port also.

docker run -d -e "SPLUNK_START_ARGS=--accept-license" -e "SPLUNK_USER=root" -p "8000:8000" -p "8089:8089"  splunk/splunk

As per my suggestion, map below splunk port also.

8191
8065
9997
515

Thanks

philipmattocks
Path Finder

In your setup, Docker is mapping port 8000 on your Docker instance onto port 8000 on your machine, which is what enables you to access the Splunk UI of the Docker instance. The -p "8000:8000" part of your initial Docker run command is what did this. You need to add another port mapping flag for 8089 to allow access to the REST API, eg -p "8089:8089" to allow access to the REST API via your local machine. So the whole Docker run command would be something like:

docker run -d -e "SPLUNK_START_ARGS=--accept-license" -e "SPLUNK_USER=root" -p "8000:8000" -p "8089:8089" splunk/splunk

Now you should be able to access the REST API via https://localhost:8089 (nb, you need to use https, not http for REST API, unlike you did in your original post)

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...