2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Amazon Bedrock AgentCore の agentcore configure コマンドが途中で止まる問題の解決方法

Last updated at Posted at 2025-07-26

結論から言うと、Docker Desktop を再インストールしたら解決したってだけなんですけど、、、
ただ、agentcore configure コマンドの実行から細かくどこに問題があるのかを辿る一例を記載してます。

新機能であるAgentCoreに興味を持って触ってみようと思ったけど
「AgentCore を触ってみよう → agentcore configure コマンドが途中で止まっちゃう → もういい!」
みたいにAgentCoreを触ってしまう人が減っちゃうのはもったいないので、極少数だとは思いますが、同じような状況の方の助けになればと思い、この記事を書きました。

前提

下記の記事を参考にさせていただきつつAgentCoreを触ってるときに遭遇した問題になります。
AgentCoreを1から触るやり方については本記事では解説しないので、下記の記事などを参考にしてみていただけると幸いです。

発生した問題

問題の概要

AgentCore のスターターツールキットで agentcore configure を実行した際、AWS の認証情報を読み込んだあとで処理が停止し、いつまで経っても完了しない状態に陥りました。

実行コマンド

agentcore configure --entrypoint my_strands_agent.py -er <AgentCoreを触る権限のあるIAM_ROLE_ARN>

実行ログ

実行すると以下のログが出力されますが、ここで停止してしまいます。

Configuring Bedrock AgentCore...
Entrypoint parsed: file=<ローカルパス>\my_strands_agent.py, bedrock_agentcore_name=my_strands_agent
Agent name: my_strands_agent

🏗️  ECR Repository
Press Enter to auto-create ECR repository, or provide ECR Repository URI to use existing
ECR Repository URI (or skip to auto-create): <ECRリポジトリの接続先>
✓ Using existing ECR repository: <ECRリポジトリの接続先>

🔍 Detected dependency file: requirements.txt
Press Enter to use this file, or type a different path (use Tab for autocomplete):
Path or Press Enter to use detected dependency file:
✓ Using detected file: requirements.txt

🔐 Authorization Configuration
By default, Bedrock AgentCore uses IAM authorization.
Configure OAuth authorizer instead? (yes/no) [no]:
✓ Using default IAM authorization
Configuring BedrockAgentCore agent: my_strands_agent
Found credentials in shared credentials file: ~/.aws/credentials
★★★ここでずっと止まってしまう★★★

問題解決のためにやったこと

1. --verbose オプションで詳細ログを確認

まず、--verbose を付けて実行し、どこで止まっているかをより詳細に確認しました。

実行コマンド

agentcore configure --entrypoint my_strands_agent.py -er <AgentCoreを触る権限のあるIAM_ROLE_ARN> --verbose

実行ログ

すると、AWSの認証情報が取得できなくて失敗しているというわけではなく、 ContainerRuntime クラスの初期化にて問題が発生しているようなログを確認することができました。

Configuring Bedrock AgentCore...
Entrypoint parsed: file=<ローカルパス>\my_strands_agent.py, bedrock_agentcore_name=my_strands_agent
Agent name: my_strands_agent

🏗️  ECR Repository
Press Enter to auto-create ECR repository, or provide ECR Repository URI to use existing
ECR Repository URI (or skip to auto-create): <ECRリポジトリの接続先>
✓ Using existing ECR repository: <ECRリポジトリの接続先>

🔍 Detected dependency file: requirements.txt
Press Enter to use this file, or type a different path (use Tab for autocomplete):
Path or Press Enter to use detected dependency file:
✓ Using detected file: requirements.txt

🔐 Authorization Configuration
By default, Bedrock AgentCore uses IAM authorization.
Configure OAuth authorizer instead? (yes/no) [no]:
✓ Using default IAM authorization
Configuring BedrockAgentCore agent: my_strands_agent
Found credentials in shared credentials file: ~/.aws/credentials
AWS account ID: <AWSアカウントID> ★新しく出力されたログ
AWS region: <AWSリージョン> ★新しく出力されたログ
Initializing container runtime with: default ★新しく出力されたログ
★★★ここでずっと止まってしまう★★★

2. AgentCore->ContainerRuntimeの内部処理の調査

AgentCoreのContainerRuntime処理 を追っていくと、利用可能なランタイム["finch", "docker", "podman"]を順番にチェックする動作をしていました。

class ContainerRuntime:
    """Container runtime for Docker, Finch, and Podman."""

    DEFAULT_RUNTIME = "auto"
    DEFAULT_PLATFORM = "linux/arm64"

    def __init__(self, runtime_type: Optional[str] = None):
        """Initialize container runtime.

        Args:
            runtime_type: Runtime type to use, defaults to auto-detection
        """
        runtime_type = runtime_type or self.DEFAULT_RUNTIME
        self.available_runtimes = ["finch", "docker", "podman"]

        if runtime_type == "auto":
            for runtime in self.available_runtimes:
                if self._is_runtime_installed(runtime):
                    self.runtime = runtime
                    break
            else:
                raise RuntimeError("No container runtime found. Please install Docker, Finch, or Podman.")
        elif runtime_type in self.available_runtimes:
            if self._is_runtime_installed(runtime_type):
                self.runtime = runtime_type
            else:
                raise RuntimeError(f"{runtime_type.capitalize()} is not installed")
        else:
            raise ValueError(f"Unsupported runtime: {runtime_type}")

また、ランタイムの確認方法 は「docker version」のようにversionをつけてコマンドを実行して確認していました。

    def _is_runtime_installed(self, runtime: str) -> bool:
        """Check if runtime is installed."""
        try:
            result = subprocess.run([runtime, "version"], capture_output=True, check=False)  # nosec B603
            return result.returncode == 0
        except (FileNotFoundError, OSError):
            return False

3. コンテナランタイムの動作確認

私の環境では Docker Desktop(Windows)を使っていました。
「docker desktopは起動してるのになー」と思いながら、agentcore configureで実施している「docker version」を手動で実行してみると、確かに反応がない・・・
※ docker --versionは反応するのに・・・

解決方法

上記の手順で、agentcore configureが途中で止まってしまう原因が「docker versionが反応しないから」というところまで突き止められました。
docker versionが反応しない理由は色々試してもうまくいかなかったので、Doccker Desktopを再インストールしてみることに。
するとものの見事に「docker version」が反応するようになり、「agentcore configure コマンド」も何事もなかったかのように、成功・・・

まとめ

変な問題にはまっちゃいましたが、agentocoreのコードを読んで「へーそんな風に動くんだ」と色々面白かったです。
もし、本事象と同じようにagentcore configure コマンドが途中で止まっちゃう場合は:

  • 1:--verbose オプションでより詳細なログを確認
  • 2:該当箇所のライブラリのコードを確認してみる
    • ※ もし、本記事のようにコンテナランタイム関連であれば、使用中のランタイム(Docker, Finch, Podman)が正常動作しているか確認してみる
      のように進めていただけると、AgentCoreが使えるようになるかもしれません。

AgentCoreは面白そうなサービスなので、セットアップ中にはまったとしても上記の手順で確認をして、投げ出さずに進めていただけると幸いです。
(やっとAgentCore使えるようになったから、何作ろうかなー)

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?