Skip to content

Dockerfile for AutoGen Studio fails to build due to UID conflict #5929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gunt3001 opened this issue Mar 13, 2025 · 7 comments · Fixed by #5932
Closed

Dockerfile for AutoGen Studio fails to build due to UID conflict #5929

gunt3001 opened this issue Mar 13, 2025 · 7 comments · Fixed by #5932
Assignees

Comments

@gunt3001
Copy link
Contributor

What happened?

Describe the bug

The Dockerfile for Autogen Studio at python/packages/autogen-studio/Dockerfile fails to build.

The issue occurs at the step that adds a user with UID 1000 (RUN useradd -m -u 1000 user). Since the base image (mcr.microsoft.com/devcontainers/python:3.10) is a Dev Container, it already includes a user with UID 1000.

This causes the build to fail with error code 4 - UID already in use.

To Reproduce

  1. Download the Dockerfile from python/packages/autogen-studio/Dockerfile into a local directory.
  2. Build the Docker image with docker build .
  3. Observe error
ERROR: failed to solve: process "/bin/sh -c useradd -m -u 1000 user" did not complete successfully: exit code: 4

Expected behavior

The Docker image should build successfully without errors.

Screenshots

N/A

Additional context

This issue is observed on the current main branch. I'm also not sure if this would be resolved as part of the ongoing effort to rewrite AutoGen Studio to AutoGen 0.4 API (#4006)

Which packages was the bug in?

AutoGen Studio (autogensudio)

AutoGen library version.

Studio 0.4.1

Other library version.

No response

Model used

No response

Model provider

None

Other model provider

No response

Python version

3.10

.NET version

None

Operating system

None

@victordibia
Copy link
Collaborator

Thanks @gunt3001,

Do you want to push a fix? I can help merge that in.

@victordibia victordibia self-assigned this Mar 13, 2025
@gunt3001
Copy link
Contributor Author

Sure thing, I can create a PR.

I'm going to make the assumption that we want to keep using the base image from Microsoft's registry. I update so that re-use existing vscode user instead of creating a new one.

@victordibia
Copy link
Collaborator

victordibia commented Mar 13, 2025

we can just revert to standard python:3.10-slim, thanks

FROM python:3.10-slim
WORKDIR /code
RUN pip install -U gunicorn autogenstudio

# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    AUTOGENSTUDIO_APPDIR=/home/user/app
WORKDIR $HOME/app
COPY --chown=user . $HOME/app
CMD gunicorn -w $((2 * $(getconf _NPROCESSORS_ONLN) + 1)) --timeout 12600 -k uvicorn.workers.UvicornWorker autogenstudio.web.app:app --bind "0.0.0.0:8081"

@victordibia
Copy link
Collaborator

P.S
You may need to pass in a dummy OPENAI_API_KEY env variable to the container (theres a part of AGS that I see creates a default oai spec and that env var is needed).

Some thing like ..

docker run -p 8081:8081 -e OPENAI_API_KEY=$OPENAI_API_KEY autogenstudio

@gunt3001
Copy link
Contributor Author

P.S You may need to pass in a dummy OPENAI_API_KEY env variable to the container (theres a part of AGS that I see creates a default oai spec and that env var is needed).

Some thing like ..

docker run -p 8081:8081 -e OPENAI_API_KEY=$OPENAI_API_KEY autogenstudio

Yep, thanks! I managed to build the image with the fixed Dockerfile and Studio was indeed complaining about that.

I created the PR. I'm also adding an additional commit updating some parts of the docs that refer to this Dockerfile to be consistent.

@victordibia
Copy link
Collaborator

Thanks. PR is looking good.
I'll fix he default env var issue in a separate PR.

P.S .. are you hosting AGS in a multi user env or mostly just local testing?

@gunt3001
Copy link
Contributor Author

Currently only local testing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants