Changing the name of a remote agent in docker

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

問題

A remote agent running inside a docker container takes the container ID as the name by default as it's based on hostname. The hostname can be modified with docker run -h myhostname. However even after specifying a new hostname for the container –  the name won't change if the <bamboo-agent-home>/bamboo-agent.cfg.xml is built into the image.

原因

When the remote agent first connects to Bamboo, it sends the specified hostname as its name, which is then registered and stored in Bamboo's database. If the agent's already registered with the server even if you change the hostname it will tie it back registered agents by UID/ID and retain the old name.

ソリューション

Modify the hostname of the container with docker run -h myhostname <image>. If the name still doesn't change due to an existing <bamboo-agent-home>/bamboo-agent.cfg.xml:

  • Rename the Agent from Bamboo Administration > Overview > Agents > Edit (it has to be done every time a new container is run)
  • Or delete the bamboo-agent.cfg.xml file from the <bamboo-agent-home> – this will force the agent to regenerate a new one with a new ID but your old agent will still remain in the list of Agents until removed. You could do this in your docker run command but it's better to make sure this file doesn't exist in the base image (please note, by removing this file the agent will be treated as new and require re-authentication) – so it entirely depends on how you want to automate your swarm.
    • e.g. docker run -h myhostname ...... /bin/bash -c "rm /home/user/bamboo/agent-home/bamboo-agent.cfg.xml"


最終更新日 2017 年 11 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.