openresty / docker-openresty

Docker tooling for OpenResty
https://hub.docker.com/r/openresty/openresty
BSD 2-Clause "Simplified" License
935 stars 525 forks source link

CentOS -> Rocky? #207

Closed karai17 closed 2 years ago

karai17 commented 2 years ago

With CentOS 8 EOL, is there any consideration to migrate the CentOS 8 docker images over to Rocky Linux? Rocky is meant to be a drop-in replacement for CentOS and they also have official Docker images.

https://hub.docker.com/r/rockylinux/rockylinux

I bring this up because I am suddenly getting errors when trying to create a new docker image using openresty/openresty:centos as a base.

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

zhuizhuhaomeng commented 2 years ago

@neomantra do you have any plan to upgrade CentOS to Rocky?

neomantra commented 2 years ago

Hi @zhuizhuhaomeng @karai17 I was wondering what the future of RH/CentOS/Fedora would be and it was clear that Centos8 is dead. I am not in that community so have no idea...

So is Rocky Linux what seems to be replacing CentOS going forward? I'm not opposed to Rocky Linux, I just don't know myself and don't want to have to support many CentOS variants here.

karai17 commented 2 years ago

Yes, Rocky is the de facto replacement for CentOS. It was even started by the same person who started CentOS back in the day~

RHEL and Fedora themselves are unchanged, but CentOS is sadly dead and Rocky was created and funded explicitly to take its place.

neomantra commented 2 years ago

Thanks for that information. I'll get this going.

Does it make sense to archive the centos flavor? (which is CentOS 8, not centos7)

karai17 commented 2 years ago

For postarity, I'd probaby archive centos and transition from centos 8.4 to rocky 8.5 and use the rocky tag going forward, though I am not exactly sure which version of centos 8 this docker image uses. RHEL, CentOS, and Rocky all use the same versioning scheme from RHEL so those versions match up.

neomantra commented 2 years ago

Actually, not that my memory is refreshed, the different CentOS variants (like Amazon Linux) are handled with build flags on the centos Dockerfile, so the new flavor is not a new Dockerfile. However, it looks like Rocky prefers dnf so the fedora Dockerfile works better.

This is what it looks like to DIY (change RESTY_RPM_ARCH to amd64 if needed):

git clone https://github.com/openresty/docker-openresty.git

cd docker-openresty

docker build -f fedora/Dockerfile \
  -t openresty:rocky-8.5 \
  --build-arg RESTY_IMAGE_BASE=rockylinux \
  --build-arg RESTY_IMAGE_TAG=8.5 \
  --build-arg RESTY_YUM_REPO="https://openresty.org/package/rocky/openresty.repo" \
  --build-arg RESTY_RPM_DIST="el8" \
  --build-arg RESTY_RPM_ARCH="aarch64" \
  .

I will add this flavor and push to CI/CD today.

karai17 commented 2 years ago

Cool, thanks! Yeah it looks like dnf is meant to finally replace yum with RHEL 8, though I'm sure it'll take until RHEL 9 before yum is deprecated and who knows when it will be removed.

One of the big differences between the variants is that they host their own software repos. openresty:centos correctly updated at some point to use the centos vault, but rocky et al host repos with continued support a la RHEL. I was getting the error in my OP because i had not rebuilt my base image before extending it and so I was trying to pull from the centos repos that no longer existed. rebuilding my image fixed that, but being stuck on software from 2021-12-31 is certainly not ideal.

neomantra commented 2 years ago

@karai17 I am doing the rocky flavor, but I think your original problem is something different. Something with the undecorated centos tag I'm trying to understand.... As you saw, we patch the Centos Repos so I think you might be using an old version (because the centos tag is stale on Docker Hub).

Can you try building your derived image from openresty/openresty:1.21.4.1-0-centos or openresty/openresty:1.19.9.1-12-centos?

karai17 commented 2 years ago

Aye, rebuilding fixed my original issue. My stale image was trying to pull from the non-vaulted repo which no longer exists.

karai17 commented 2 years ago

RE: using fedora instead of centos as the base

Why not use the actual rockylinux dockerfile as the base instead of fedora?

neomantra commented 2 years ago

There doesn't need to be a specific "rockylinux" Dockerfile because the differences between fedora and rocky are just a few build parameters, so it is easier to maintain. Right now it's basically centos/Dockerfile for YUM-based installs and fedora/Dockerfile for DNF-based installs.

neomantra commented 2 years ago

Available now as image: openresty/openresty:rocky. Will do a tag over the weekend.

neomantra commented 2 years ago

This is released now: openresty/openresty:1.21.4.1-1-rocky.