Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker/base_images/base_image.Dockerfile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ ENV CUDNN_VERSION="8.9.5.29"
ENV CUDA="12.2"
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

sed -i.bak 's|http://archive.ubuntu.com/ubuntu/|http://mirror.ubuntu.com/ubuntu/ http://archive.ubuntu.com/ubuntu/|g' /etc/apt/sources.list; \
fi

RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
Expand Down
Loading