Skip to content

Permission denied Error with runtimes build by Agentcore SDK #652

Description

@arindam6713

Describe the bug
The Docker file generated by running the agentcore configure command has the following -

Create non-root user

RUN useradd -m -u 1000 bedrock_agentcore
USER bedrock_agentcore

EXPOSE 9000
EXPOSE 8000
EXPOSE 8080

Copy entire project (respecting .dockerignore)

COPY . .

However when the agent is called , it gives permission denied to run the agent.py file

To Reproduce
Steps to reproduce the behavior:
Execute the agentcore configure command with the required python file and requirement file.

Once the runtime is available , try to test the endpoint ,
4. See error
Cloudwatch logs :

2026-08-26T08:23:00.907Z | Traceback (most recent call last): -- | --   | 2026-08-26T08:23:00.907Z File "", line 189, in _run_module_as_main | File "", line 189, in _run_module_as_main   | 2026-08-26T08:23:00.907Z File "", line 159, in _get_module_details | File "", line 159, in _get_module_details   | 2026-08-26T08:23:00.907Z File "", line 1073, in get_code | File "", line 1073, in get_code   | 2026-08-26T08:23:00.907Z File "", line 1130, in get_data | File "", line 1130, in get_data   | 2026-08-26T08:23:00.907ZPermissionError: [Errno 13] Permission denied: '/app/stockanalysisagent.py'

Expected behavior

It should not give permission error

As a work around i have tried to edit the docker file as follows

Create non-root user

RUN useradd -m -u 1000 bedrock_agentcore

Copy project files with explicit ownership to avoid runtime permission errors

COPY --chown=bedrock_agentcore:bedrock_agentcore . .
RUN chmod -R u=rwX,go=rX /app

USER bedrock_agentcore

EXPOSE 9000
EXPOSE 8000
EXPOSE 8080

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghigh-severityOutage, data loss, security issue, crash with no workaround, or regression in a released version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions