【问题标题】:How to set admin user/pwd when launching Nexus docker image启动 Nexus docker 映像时如何设置管理员用户/密码
【发布时间】:2020-10-02 18:11:22
【问题描述】:

在启动 Nexus 2 docker 映像 (https://hub.docker.com/r/sonatype/nexus/) 时,如何配置它以将默认管理员用户密码更改为 admin/admin123 以外的其他内容?

谢谢。

【问题讨论】:

  • 不幸的是你不能。一旦容器启动并更改密码,您必须使用默认凭据登录。我不再使用nexus2,也没有对其进行投资,但我有automated this kind of tasks 使用a groovy script 对nexus3 进行ansible,如果这有任何帮助的话。

标签: nexus


【解决方案1】:

@Zeitounator, 感谢您的回答,但实际上我确实设法更改了管理员密码。 在 docker 映像中,您需要更新 /sonatype-work/conf/security.xml 文件。 有一个管理部分,您需要在其中更改密码元素

<user>
  <id>admin</id>
  <firstName>Administrator</firstName>
  <lastName>User</lastName>
  <password>change_password_here</password>
  <status>active</status>
  <email>changeme@yourcompany.com</email>
</user>

我正在使用 kubernetes 启动 Nexus,通过安装正确的文件,我能够更改密码。

为了生成密码,我使用了 shiro 工具 hasher cli:https://shiro.apache.org/command-line-hasher.html

【讨论】:

    【解决方案2】:

    要第一次更改管理员密码,请按照以下步骤操作(docker 仅限版本):

    转到 Nexus 容器实例,例如 91aefe723146

      make a docker exec -it 91aefe723146 /bin/bash
      
    

    转到 /nexus 数据

      get the password content of the file admin.password
    

    再次登录管理控制台并输入密码并重新初始化您的密码。 完成!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 2018-10-19
      相关资源
      最近更新 更多