Docker Community Forums

Share and learn in the Docker community.

Run command to add user in splunk via docker-composite

#1

Hello ,

I am trying to run an instance of splunk on docker-composite.
Everything seems working , But I need to run splunk command to add a user, I don’t know how to do it via docker-composer.

  • So my problem is "How to configure docker-compose to
    run "?

splunk add user test -role Admin -password testpassword -full-name “TEST”

  • My Config docker-compose :

version: “2”

services:
splunk:
#build: .
hostname: splunk
image: splunk/splunk:7.2
environment:
SPLUNK_START_ARGS: --accept-license --answer-yes
SPLUNK_ENABLE_LISTEN: 9997
SPLUNK_ADD: tcp 1514
SPLUNK_PASSWORD: “test12345”
volumes:

  • xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    ports:
  • “8000:8000”
  • “9997:9997”
  • “8088:8088”
  • “1514:1514”

THANK YOU IN ADVANCE !!!

(Nitishmowall) #2

you can add command parameter to docker compose file to run any command. but it will override the existing CMD step in the image. So one thing you can do is to get the slunk docker file and add your changes and build your image
please read the below link for building slunk image from source

Here is the repo for image

i