I have created a Dockerfile when the container build during that time I need to create multiple login users on backside of Splunk.
I am getting splunk agreement issue able unable to skip/accept agreement on build container.
ENV SPLUNK_HOME /opt/splunk
RUN apt-get update && apt-get install -y wget
COPY ./splunk-launch.conf /opt/splunk/etc/splunk-launch.conf COPY ./splunk.license /opt/splunk/etc/licenses/enterprise/splunk.license
COPY ./My-app1 / /opt/splunk/etc/apps/My-app1 COPY ./My-app2 /opt/splunk/etc/apps/My-app2 COPY ./My-app3 /opt/splunk/etc/apps/My-app3
COPY ./splunkuser.sh /opt/splunk/bin/splunkuser.sh
RUN chmod +x /opt/splunk/bin/splunkuser.sh RUN chown -R splunk:splunk /opt/splunk/bin/splunkuser.sh
EXPOSE 8000/tcp 8089/tcp 8191/tcp 9997/tcp 1514 8088/tcp
VOLUME [ “/opt/splunk/etc”, “/opt/splunk/var” ]
./splunk add user pradeep -password passwd123 -role admin -email firstname.lastname@example.org -full-name Pradeep -auth admin:changeme ./splunk add user sankar -password passwd123 -role admin -email email@example.com -full-name Sankar -auth admin:changeme
Generally if you want to accept license agreement using CLI when you start splunk first time then command should be
$SPLUNK_HOME/bin/splunk start --accept-license, I don't have much more knowledge on Docker so command which I have provided might help you.
I would highly suggest you on how official image does that, it is open sourced and you can find all the scripts to build the image under https://github.com/splunk/docker-splunk, and specifically the entrypoint.sh file https://github.com/splunk/docker-splunk/blob/master/enterprise/entrypoint.sh
I am not sure if creating users inside the image is a good idea, considering that they are will be stored under /opt/splunk/etc, which will be mapped to some other volume first time you are going to start the image. Also all the default etc files are stored under https://github.com/splunk/docker-splunk/blob/master/enterprise/entrypoint.sh#L21, so if you really wants to put your apps inside the image, you should put them under
/var/opt/splunk/etc, so image will place them in the right place when you will try to start the image for the first time. You can actually store also users information here as well.
Also you are overriding default CMD with
CMD [“./splunk_user.sh”] which means that you are going to override default