Skip to content

Conversation

Copy link

Copilot AI commented Feb 9, 2026

  • Switch samples/volumes/Dockerfile from alpine:3.14 to official Python Alpine base image
  • Remove the now-unnecessary apk add python3 py3-pip line since Python and pip come with the base image
  • Simplify pip install to single pip install --no-cache-dir -r requirements.txt command
  • Pin base image to python:3.12-alpine for reproducible builds, consistent with other sample Dockerfiles
  • Run code review and security checks
Original prompt

This section details on the original issue you should resolve

<issue_title>Dockerfile build fails to uninstall 'packaging' distutils</issue_title>
<issue_description>## Bug information

Steps to reproduce (required)

  1. Run the Test Samples (K3D) workflow. The workflow triggers a Dockerfile build in samples/volumes/Dockerfile.
  2. The build step executes RUN python3 -m pip install --upgrade pip setuptools wheel && python3 -m pip install --no-cache-dir -r requirements.txt on an Alpine Python image.

Observed behavior (required)

  • The build fails with the following error:
ERROR: Cannot uninstall 'packaging'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
ERROR: process "/bin/sh -c python3 -m pip install --upgrade pip setuptools wheel     && python3 -m pip install --no-cache-dir -r requirements.txt" did not complete successfully: exit code: 1
  • This error originates from the existing packaging distutils project in the image. Pip cannot uninstall it cleanly.
  • The failure is traced to this line in the Dockerfile:
RUN python3 -m pip install --upgrade pip setuptools wheel 
    && python3 -m pip install --no-cache-dir -r requirements.txt

Desired behavior (required)

  • The Docker image build and all workflow steps should complete successfully.

Workaround (optional)

  • Use a Python base image that does not have distutils-preinstalled packages or
  • Specify --ignore-installed for pip, or
  • Update the Dockerfile step to check for an existing installation and avoid upgrading/distutils uninstall.

Suggested fix

  • Consider switching to a Python official base image (e.g. python:3.10-alpine instead of alpine:3.14) which installs packages cleanly via pip.
  • Alternatively, update the Dockerfile to explicitly install packaging before upgrading pip, or use --ignore-installed with pip install.
  • See the logs in Workflow Run 21015933695/job/63031933365 for context.

System information

rad Version (required)

Operating system (required)

Additional context

AB#18169</issue_description>

Comments on the Issue (you are @copilot in this section)

@brooke-hamilton Related to #2482

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Replace alpine:3.14 with python:3-alpine to avoid the distutils-installed
'packaging' conflict that prevents pip from upgrading packages. The official
Python image includes pip without distutils conflicts, eliminating the error:
"Cannot uninstall 'packaging'. It is a distutils installed project."

Co-authored-by: brooke-hamilton <45323234+brooke-hamilton@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Dockerfile build failure when uninstalling 'packaging' Fix volumes Dockerfile build failure from distutils packaging conflict Feb 9, 2026
Copilot AI requested a review from brooke-hamilton February 9, 2026 22:41
@brooke-hamilton brooke-hamilton marked this pull request as ready for review February 9, 2026 23:47
@brooke-hamilton brooke-hamilton requested review from a team as code owners February 9, 2026 23:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the samples/volumes container build failure caused by Alpine’s distutils-managed packaging conflicting with pip during dependency installation, by switching to an official Python Alpine base image and simplifying the install layer.

Changes:

  • Switch samples/volumes base image from alpine:3.14 (+ apk-installed Python/pip) to python:3-alpine.
  • Remove the apk add step and the pip upgrade step; install requirements directly with pip install -r requirements.txt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: brooke-hamilton <45323234+brooke-hamilton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dockerfile build fails to uninstall 'packaging' distutils

2 participants