Skip to content

docker-entrypoint.sh fails when host user is root (UID 0) #21

Description

@lroolle

Description

docker-entrypoint.sh crashes with 'usermod: UID 0 already exists' when running claude-yolo as root user on host.

Type

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Details

Problem: When host user is root (UID=0), docker-entrypoint.sh tries to create claude user with UID=0, but root user already exists with UID=0.

Error:
usermod: UID '0' already exists

Root Cause:

  • Host passes CLAUDE_UID=$(id -u) to container
  • When host user is root, CLAUDE_UID=0
  • Container tries: usermod -u 0 claude
  • Fails because root (UID=0) already exists

Solution:
Detect UID=0 case and handle specially - either skip usermod or use fallback UID.

Related Files

  • docker-entrypoint.sh (UID/GID setup logic)
  • claude.sh (UID/GID detection and passing)

Test Plan

  • Test claude-yolo as root user on Linux host
  • Test claude-yolo as non-root user (existing case)
  • Verify file permissions work correctly in both cases
  • Test with custom CLAUDE_UID override

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions