Skip to content

Conversation

ndeepak-baseten
Copy link
Contributor

🚀 What

Set mirrors for Ubuntu image. Other images including python-* are Debian-based, and deb.*.org already uses mirrors.

💻 How

Add a sed command to set configuration at build time.

🔬 Testing

TBD.

ENV LD_LIBRARY_PATH="/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH"

{# Configure Ubuntu mirrors with fallbacks for better reliability #}
RUN if [ -f /etc/apt/sources.list ] && ! grep -q "mirror.ubuntu.com" /etc/apt/sources.list; then \
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a more declarative way to do this (rather than piping new content iN?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@squidarth Can be done, requires a bit more work:

  1. apt-add-repository requires Debian release, so we need to discover and place that appropriately
  2. apt uses the first repo it sees, so we have to pin priorities.

Looks like this:

# Add mirror repository
RUN add-apt-repository -y "deb http://mirror.ubuntu.com/ubuntu/ $(lsb_release -sc) main restricted universe multiverse"

# Set priority to prefer mirror.ubuntu.com
RUN echo "Package: *" > /etc/apt/preferences.d/ubuntu-mirrors && \
    echo "Pin: origin mirror.ubuntu.com" >> /etc/apt/preferences.d/ubuntu-mirrors && \
    echo "Pin-Priority: 600" >> /etc/apt/preferences.d/ubuntu-mirrors

This is more touchpoints and also overwrites the ubuntu-mirrors file. The sed solution is simpler, also seeing it on forums, do you feel strongly?

Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems reasonable!

Copy link
Contributor

Choose a reason for hiding this comment

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

If we do decide to go with this approach, just FYI that we have to:

  1. build new base images
  2. update base version image tag

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.

3 participants