How to install git-lfs in docker instance used in the Docker Hub Autobuild process?

According to this page: Advanced options for Autobuild and Autotest | Docker Documentation

I created a hooks/build file and wrote something like this:

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | bash
yum install git-lfs -y

To install git-lfs. and got an error like this:


2023-07-08T09:38:00Z Detected operating system as ubuntu/18.
2023-07-08T09:38:00Z Checking for curl...
2023-07-08T09:38:00Z Detected curl...
2023-07-08T09:38:00Z Downloading repository file: https://packagecloud.io/install/repositories/github/git-lfs/config_file.repo?os=ubuntu&dist=18&source=script
2023-07-08T09:38:00Z main: line 165: /etc/yum.repos.d/github_git-lfs.repo: No such file or directory
2023-07-08T09:38:00Z
2023-07-08T09:38:00Z Unable to run:
2023-07-08T09:38:00Z curl https://packagecloud.io/install/repositories/github/git-lfs/config_file.repo?os=ubuntu&dist=18&source=script
2023-07-08T09:38:00Z
2023-07-08T09:38:00Z Double check your curl installation and try again.
2023-07-08T09:38:00Z hooks/build: line 30: yum: command not found
  1. ​It seems yum is not installed but the doc said that the machine is based on Amazon Linux 2​ which is Red Hat so it should have yum command available. Why is it not available?
  2. I need to use git-lfs to pull some binary files to be copied into the docker build process. How can I do it?
  3. Can we see the default content of hooks/build file before it’s overriden by me? I want to know how exactly Docker writes their own build command so that I can modify it to suit my needs. Because I have an issue where the cache of docker images is not utilized properly in my own hooks/build file. I want to see how to preserve the cache between builds.

Update: Let me answer part of the question. I just found out that I have to use debian-based command instead of red hat-based.

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs

This command works. So it means the docker doc is mistaken?
Because it said this:

These hooks run on an instance of Amazon Linux 2, a distro based on Red Hat Enterprise Linux (RHEL), which includes interpreters such as Perl or Python, and utilities such as git or curl. Refer to the Amazon Linux 2 documentation for the full list of available interpreters and utilities.

It seems the machine is not Red Hat.

I’m still looking for the answer on the 3rd question though.