Hi LiveKit Support, I’m trying to <create a new a...
# cloud
o
Hi LiveKit Support, I’m trying to create a new agent using the CLI command:
Copy code
lk agent create
but the build keeps failing during the Docker step with the following error:
Copy code
failed to Lchown "/Dockerfile" for UID 845483959, GID 1437349805: 
lchown /Dockerfile: invalid argument
Full log excerpt:
Copy code
[+] Building 0.5s (2/2) FINISHED
 => [internal] load remote build context 0.1s
 => ERROR copy /context / 0.0s
------
 > copy /context /:
------
build failed for iad.ocir.io/axyci3pr8vxm/production-cloud-agents:p-3r36ywewesj-ca-gbxb4sonkna4-v20250918075554: failed to solve: failed to read dockerfile: failed to Lchown "/Dockerfile" for UID 845483959, GID 1437349805: lchown /Dockerfile: invalid argument
My environment: • macOS with Colima • Using Python (uv) project • Dockerfile already exists (provided by the project) • Tried disabling BuildKit (DOCKER_BUILDKIT=0) and running Colima in rootful mode, but the same error occurs. My project directory tree:
Copy code
.
├── Dockerfile
├── README.md
├── livekit
│   └── hold_for_me.py
├── livekit.toml
├── pyproject.toml
├── run_livekit.py
└── uv.lock
Here’s my Dockerfile :
Copy code
# This is an example Dockerfile that builds a minimal container for running LK Agents
# For more information on the build process, see https://docs.livekit.io/agents/ops/deployment/builds/
# syntax=docker/dockerfile:1

# Use the official UV Python base image with Python 3.13 on Debian Bookworm
# UV is a fast Python package manager that provides better performance than pip
# We use the slim variant to keep the image size smaller while still having essential tools
ARG PYTHON_VERSION=3.13
FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-bookworm-slim AS base

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
ARG UID=10001
RUN adduser \
    --disabled-password \
    --gecos "" \
    --home "/app" \
    --shell "/sbin/nologin" \
    --uid "${UID}" \
    appuser

# Install build dependencies required for Python packages with native extensions
# gcc: C compiler needed for building Python packages with C extensions
# g++: C++ compiler needed for building Python packages with C++ extensions
# python3-dev: Python development headers needed for compilation
# We clean up the apt cache after installation to keep the image size down
RUN apt-get update && apt-get install -y \
    gcc \
    g++ \
    python3-dev \
  && rm -rf /var/lib/apt/lists/*

# Create a new directory for our application code
# And set it as the working directory
WORKDIR /app

# Copy just the dependency files first, for more efficient layer caching
COPY pyproject.toml uv.lock ./
RUN mkdir -p src

# Install Python dependencies using UV's lock file
# --locked ensures we use exact versions from uv.lock for reproducible builds
# This creates a virtual environment and installs all dependencies
# Ensure your uv.lock file is checked in for consistency across environments
RUN uv sync --locked

# Copy all remaining pplication files into the container
# This includes source code, configuration files, and dependency specifications
# (Excludes files specified in .dockerignore)
COPY . .

# Change ownership of all app files to the non-privileged user
# This ensures the application can read/write files as needed
RUN chown -R appuser:appuser /app

# Switch to the non-privileged user for all subsequent operations
# This improves security by not running as root
USER appuser

# Pre-download any ML models or files the agent needs
# This ensures the container is ready to run immediately without downloading
# dependencies at runtime, which improves startup time and reliability
RUN uv run "run_livekit.py" download-files

# Run the application using UV
# UV will activate the virtual environment and run the agent.
# The "start" command tells the worker to connect to LiveKit and begin waiting for jobs.
CMD ["uv", "run", "run_livekit.py", "start"]
(Note: This is the actual Dockerfile I’m using. The error seems to occur during the COPY step.) Do you know what might cause this lchown error when creating an agent? Is there a recommended workaround for Colima/macOS environments? Thanks in advance for your help!
✅ 1
Just to add, I also tried with the example project provided here – https://github.com/livekit-examples/agent-starter-python. Running lk agent create there produces the same error, so it doesn’t seem specific to my project setup.
e
hello, if you have .dockerignore or .gitignore in these dirs could you share the contents?
o
Hi Dan, Sure — please find attached the contents of the .dockerignore and .gitignore files from those directories. Let me know if you need anything else! • .dockerignore
Copy code
# Python bytecode and artifacts
**/__pycache__/
**/*.py[cod]
**/*.pyo
**/*.pyd
**/*.egg-info/
**/dist/
**/build/

# Virtual environments
**/.venv/
**/venv/

# Caches and test output
**/.cache/
**/.pytest_cache/
**/.ruff_cache/
**/coverage/

# Logs and temp files
**/*.log
**/*.gz
**/*.tgz
**/.tmp
**/.cache

# Environment variables
**/.env
**/.env.*

# VCS, editor, OS
.git
.gitignore
.gitattributes
.github/
.idea/
.vscode/
.DS_Store

# Project docs and misc
README.md
LICENSE

# Project tests
test/
tests/
eval/
evals/
• .gitignore
Copy code
# Environment variables
.env*
!.env.example
.DS_Store
__pycache__
.idea
KMS
.venv
.vscode
*.egg-info
.pytest_cache
.ruff_cache
app/grpc_server/generated/
e
could you try an
lk a deploy
with this setup? would like to grab some debug logs on my side if i can
o
I ran
lk a deploy
with the setup you mentioned — please find attached the error logs from my side. Also, out of our 5 team members, 4 experienced failures when running lk agent create, while 1 was successful and that agent is currently deployed in the project. Let me know if you need any additional details or tests!
Copy code
❯ lk a deploy
Using default project [hold-for-me-agent]
Using agent [CA_sKYbbsNAnZLk]
Uploading 100% [==============================] (385 kB/s)
Updated agent [CA_sKYbbsNAnZLk]
[+] Building 0.7s (2/2) FINISHED
 => [internal] load remote build context                                                                                                                                                                                               0.2s
 => ERROR copy /context /                                                                                                                                                                                                              0.0s
------
 > copy /context /:
------
build failed for iad.ocir.io/axyci3pr8vxm/production-cloud-agents:p-a18vq3dzo1t-ca-skybbsnanzlk-v20250923220748: failed to solve: failed to read dockerfile: failed to Lchown "/Dockerfile" for UID 845483959, GID 1437349805: lchown /Dockerfile: invalid argument
l
Hi @orange-jordan-8158 are you on windows environment? Could you share your Dockerfile with us?
Are you using
livekit-cli
generated Dockerfile?
Could you explain what you are trying to do here?
Copy code
copy /context /:
ah never mind, I see your Dockerfile further up in this thread
e
out of our 5 team members, 4 experienced failures when running lk agent create
are you all in the same geo location or is the successful create somewhere else?
l
Okay, i was able to reproduce this on my machine. The issue comes from incompatible UID/GID between osx and linux. You can reproduce this by doing this:
Copy code
chown 845483959:1437349805 pyproject.toml
The issue stems from large number UID/GID assigned by your colima
o
Hi Dan and Steve, To clarify — out of our 5 team members, 4 are using company-provided Macs and experienced failures, while 1 used a personal Mac and was able to succeed. Also, we generated our Dockerfile using the livekit-cli.
l
Are you running
livekit-cli
within colima container? If so, you can explicitly change ownership to valid UID/GID.
Copy code
chown -R 1000:1000 ./
👀 1
o
thank you so much 🙏 running it with sudo worked perfectly! Really appreciate your help on this.
🙌 2