Skip to content

PermissionError when starting processor after custom container build #112

@itsmanikandanm

Description

@itsmanikandanm

Is there an existing issue for this?

  • I have searched the existing issues and added correct labels.

Description

When building a custom container image for the ayon-kitsu processor service , worker fails to start the processor service and exits with a PermissionError.

Steps To Reproduce:

Reproduction Steps

  1. Create a Dockerfile that builds a custom version of the processor service.

  2. Add or patch files (e.g., patching gazu to fix token authentication or event namespace connection).

  3. Copy the processor folder using COPY processor /service/processor after setting up permissions and user.

  4. Build and run the image.

  5. Deploy it with sync or run it locally.

Root Cause

In the original Dockerfile, the COPY processor /service/processor command is executed after the ownership and permission changes:

RUN chown ayonuser:ayonuser -R /service
RUN chmod 777 -R /service
COPY processor /service/processor  # This line overwrites previous permissions

This causes /service/processor/ and its contents to be owned by root, leading to PermissionError when tries to import the module as the unprivileged ayonuser.

✅ Recommended Fix
Reorder the Dockerfile to copy the processor before setting permissions, like so:

COPY processor /service/processor

RUN chown -R ayonuser:ayonuser /service \
 && chmod -R a+rX /service

This ensures that the copied files are accessible by the ayonuser, avoiding the PermissionError.

Additional context:

Version

ayon-kitsu-processor:1.2.5

Based on python:3.11-alpine3.18

Relevant log output:

2025-06-26 17:24:05 WARNING    ash             processor exited with code 1

2025-06-26 17:24:07 INFO       ash             Starting processor kitsu:1.2.5/processor (image: custom/ayon-kitsu-processor:1.2.5)

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap_external>", line 1130, in get_data
PermissionError: [Errno 13] Permission denied: '/service/processor/__init__.py'

Metadata

Metadata

Assignees

No one assigned

    Labels

    communityIssues and PRs coming from the community memberstype: bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions