我从repository README中学到,我正在使用splunk/splunk
docker image和以下命令来构建和运行:
docker build --network=$DOCKER_NETWORK -t my-splunk .
docker run \
--name=my-splunk \
--network=$DOCKER_NETWORK \
-p 8000:8000 \
-e SPLUNK_START_ARGS="--accept-license" \
-e SPLUNK_PASSWORD="1234" \
--restart unless-stopped \
-d my-splunk
当我在
localhost:8000
上打开浏览器时,按预期方式获得了Splunk登录页面,但是,当键入admin
和1234
时,出现了错误401:No users exist. Please set up a user.
从容器中查看
/opt/splunk/etc/system/local/user-seed.conf
,内容看起来不错:[user_info]
USERNAME = admin
PASSWORD = 1234
完整的docker日志:
PLAY [localhost] ***************************************************************
TASK [Gathering Facts] *********************************************************
Sunday 07 October 2018 17:39:17 +0300 (0:00:00.091) 0:00:00.091 ********
ok: [localhost]
TASK [include_role : splunk_upgrade] *******************************************
Sunday 07 October 2018 17:39:18 +0300 (0:00:01.821) 0:00:01.913 ********
TASK [include_role : {{ splunk.role }}] ****************************************
Sunday 07 October 2018 17:39:19 +0300 (0:00:00.031) 0:00:01.945 ********
TASK [splunk_common : Install Splunk] ******************************************
Sunday 07 October 2018 17:39:19 +0300 (0:00:00.075) 0:00:02.021 ********
changed: [localhost]
TASK [splunk_common : Install Splunk (Windows)] ********************************
Sunday 07 October 2018 17:39:47 +0300 (0:00:28.257) 0:00:30.278 ********
TASK [splunk_common : Generate user-seed.conf] *********************************
Sunday 07 October 2018 17:39:47 +0300 (0:00:00.041) 0:00:30.320 ********
changed: [localhost] => (item=USERNAME)
changed: [localhost] => (item=PASSWORD)
TASK [splunk_common : include_tasks] *******************************************
Sunday 07 October 2018 17:39:47 +0300 (0:00:00.377) 0:00:30.697 ********
included: /opt/ansible/roles/splunk_common/tasks/enable_s2s_port.yml for localhost
TASK [splunk_common : Enable the Splunk-to-Splunk port] ************************
Sunday 07 October 2018 17:39:47 +0300 (0:00:00.062) 0:00:30.759 ********
changed: [localhost]
TASK [splunk_common : include_tasks] *******************************************
Sunday 07 October 2018 17:39:50 +0300 (0:00:02.733) 0:00:33.492 ********
included: /opt/ansible/roles/splunk_common/tasks/start_splunk.yml for localhost
TASK [splunk_common : Start Splunk] ********************************************
Sunday 07 October 2018 17:39:50 +0300 (0:00:00.054) 0:00:33.547 ********
changed: [localhost]
TASK [splunk_common : include_tasks] *******************************************
Sunday 07 October 2018 17:39:57 +0300 (0:00:07.214) 0:00:40.761 ********
included: /opt/ansible/roles/splunk_common/tasks/add_splunk_license.yml for localhost
TASK [splunk_common : Download Splunk license] *********************************
Sunday 07 October 2018 17:39:57 +0300 (0:00:00.056) 0:00:40.818 ********
TASK [splunk_common : Set downloaded license location] *************************
Sunday 07 October 2018 17:39:57 +0300 (0:00:00.037) 0:00:40.855 ********
TASK [splunk_common : Set local license location] ******************************
Sunday 07 October 2018 17:39:57 +0300 (0:00:00.034) 0:00:40.889 ********
ok: [localhost]
TASK [splunk_common : Apply Splunk license] ************************************
Sunday 07 October 2018 17:39:58 +0300 (0:00:00.043) 0:00:40.933 ********
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["/opt/splunk/bin/splunk", "add", "licenses", "-auth", "admin:1234"], "delta": "0:00:01.050830", "end": "2018-10-07 17:39:59.189296", "msg": "non-zero return code", "rc": 4, "start": "2018-10-07 17:39:58.138466", "stderr": "", "stderr_lines": [], "stdout": "missing PATH-TO-LICENSE-FILE argument: ./splunk add license [PATH-TO-FILE] ", "stdout_lines": ["missing PATH-TO-LICENSE-FILE argument: ./splunk add license [PATH-TO-FILE] "]}
...ignoring
TASK [splunk_common : Set as license slave] ************************************
Sunday 07 October 2018 17:39:59 +0300 (0:00:01.213) 0:00:42.146 ********
TASK [include_role : splunk_search_head] ***************************************
Sunday 07 October 2018 17:39:59 +0300 (0:00:00.031) 0:00:42.178 ********
PLAY RECAP *********************************************************************
localhost : ok=10 changed=5 unreachable=0 failed=0
Sunday 07 October 2018 17:39:59 +0300 (0:00:00.048) 0:00:42.226 ********
===============================================================================
splunk_common : Install Splunk ----------------------------------------- 28.26s
splunk_common : Start Splunk -------------------------------------------- 7.21s
splunk_common : Enable the Splunk-to-Splunk port ------------------------ 2.73s
Gathering Facts --------------------------------------------------------- 1.82s
splunk_common : Apply Splunk license ------------------------------------ 1.21s
splunk_common : Generate user-seed.conf --------------------------------- 0.38s
include_role : {{ splunk.role }} ---------------------------------------- 0.08s
splunk_common : include_tasks ------------------------------------------- 0.06s
splunk_common : include_tasks ------------------------------------------- 0.06s
splunk_common : include_tasks ------------------------------------------- 0.05s
include_role : splunk_search_head --------------------------------------- 0.05s
splunk_common : Set local license location ------------------------------ 0.04s
splunk_common : Install Splunk (Windows) -------------------------------- 0.04s
splunk_common : Download Splunk license --------------------------------- 0.04s
splunk_common : Set downloaded license location ------------------------- 0.03s
include_role : splunk_upgrade ------------------------------------------- 0.03s
splunk_common : Set as license slave ------------------------------------ 0.03s
===============================================================================
Ansible playbook complete, will begin streaming var/log/splunk/splunkd_stderr.log
最佳答案
好吧,显然密码必须符合https://hub.docker.com/r/splunk/splunk/的某些默认要求:
For a basic standalone Splunk environment, run the following command:
$ docker run -d -p 8000:8000 -e 'SPLUNK_START_ARGS=--accept-license' -e 'SPLUNK_PASSWORD=' splunk/splunk:latest Note: The password supplied must conform to the default Splunk Enterprise password requirements*
将密码从“1234”更改为“12345678910”后,登录正常(仅默认要求,密码长度至少应为8个字符)。
由于创建用户的失败已被静音,并且仅在dockerhub中记录了此问题,而在github中没有记录,因此我将打开一个案例以通知他们。
关于docker - 部署Splunk Docker镜像无法登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52689758/