pytorch icon indicating copy to clipboard operation
pytorch copied to clipboard

dockerhub images appear to be build images instead of runtime

Open bjj opened this issue 9 months ago • 1 comments

🐛 Describe the bug

The rocm/pytorch images on dockerhub are quite large, see for example https://hub.docker.com/layers/rocm/pytorch/latest/images/sha256-05b55983e5154f46e7441897d0908d79877370adca4d1fff4899d9539d6c4969

This is causing all docker containers based on these images to be many times larger than necessary.

This appears to be because the published images are actually the builder images rather than the runtime images. This is surprising, since this is a fork of pytorch/pytorch, which does not have this issue. I wonder if this is just a mistake in tagging somewhere?

Versions

rocm/pytorch:latest

bjj avatar Mar 17 '25 05:03 bjj

Hi @bjj. Internal ticket has been created to investigate this issue. Thanks!

ppanchad-amd avatar Mar 18 '25 14:03 ppanchad-amd

This is because it includes full build tools, ROCm SDK, source code, and testing artifacts. It's clearly a builder image, not a runtime image.

If you just need to run PyTorch with ROCm (inference, not building), you can build your own minimal runtime image using this


FROM ubuntu:22.04
RUN apt update && apt install -y libnuma1 libtinfo6 libstdc++6 libjpeg-dev libpng-dev

COPY --from=build /opt/rocm /opt/rocm
COPY --from=build /opt/conda /opt/conda

ENV PATH="/opt/conda/bin:$PATH"
ENV LD_LIBRARY_PATH="/opt/rocm/lib:/opt/rocm/lib64:/opt/conda/lib"

CMD ["python3"]

This will get you a lightweight ~2–3 GB runtime container for deploying ROCm+PyTorch models.

adityas-amd avatar May 14 '25 19:05 adityas-amd