duplicate path in $PATH

Open
#899 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
docker, python
Domain
devops

Research direction

Start by searching the repository for where PATH is defined for the Python base images, then compare that value with the environment shown by the provided docker run and Python commands. Done means the affected images no longer duplicate /usr/local/bin while preserving the expected path order.

Written by the indexing model from the issue text.

Description

Minor nit. We blindly prepend /usr/local/bin onto the $PATH without looking to see if it's already there. This leads to duplication.

docker run --rm -it python:3.12-slim

Python 3.12.1 (main, Jan 11 2024, 10:03:43) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['PATH']
'/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

Expected output: /usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin

Or possibly the original path is fine? Since /usr/local/sbin already occurs before /usr/bin and /bin.

This applies to all the base images in here. They all come with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin for the root user.

Dominant language
Dockerfile
Stars
2.8k
Forks
1.1k
Avg merge
3d 1h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docker-library/python

All issues in docker-library/python

Similar issues

More DevOps issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.