{"id":20589653,"url":"https://github.com/coreos/custom-coreos-disk-images","last_synced_at":"2025-04-14T22:07:41.099Z","repository":{"id":223792337,"uuid":"761458964","full_name":"coreos/custom-coreos-disk-images","owner":"coreos","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-20T14:45:25.000Z","size":78,"stargazers_count":3,"open_issues_count":0,"forks_count":7,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-14T22:07:29.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coreos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-21T21:46:32.000Z","updated_at":"2025-03-20T14:45:29.000Z","dependencies_parsed_at":"2024-04-30T20:32:40.217Z","dependency_job_id":"c8ba4925-93a2-4d76-8ccf-9c1fdcbce321","html_url":"https://github.com/coreos/custom-coreos-disk-images","commit_stats":null,"previous_names":["dustymabe/build-custom-rhcos-disks","coreos/custom-coreos-disk-images"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fcustom-coreos-disk-images","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fcustom-coreos-disk-images/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fcustom-coreos-disk-images/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fcustom-coreos-disk-images/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coreos","download_url":"https://codeload.github.com/coreos/custom-coreos-disk-images/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968845,"owners_count":21191162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T07:30:13.452Z","updated_at":"2025-04-14T22:07:41.089Z","avatar_url":"https://github.com/coreos.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# custom-coreos-disk-images\n\nThis repo contains files and instructions for building customized\nFCOS (Fedora CoreOS) and RHCOS (Red Hat Enterprise Linux CoreOS)\ndisk images. In the case of RHCOS these images can then be used for\ninstallation and bootstrapping of OpenShift Clusters.\n\n# Creating a custom RHCOS container Image\n\nSome background context and some examples for creating layered RHCOS\ncontainer imags can be found in the\n[OpenShift Documentation](https://docs.openshift.com/container-platform/4.14/post_installation_configuration/coreos-layering.html).\nSome of that is reproduced here to provide a full example.\n\nFor this to work you will need a registry pull secret. If you have a\ncluster up and running already then you most likely have that set up.\nIf not, then you should be log in and grab your pull secret from\n[console.redhat.com](https://console.redhat.com/openshift/install/pull-secret).\n\nIn order to figure out what container image to base your layered\ncontainer on you can get that from your cluster like:\n\n```\noc adm release info --image-for rhel-coreos\n```\n\nor from quay specifying the version like:\n\n```\noc adm release info --image-for=rhel-coreos quay.io/openshift-release-dev/ocp-release:4.18.2-x86_64\n```\n\nwhere you can replace `4.18.2` with the version of OpenShift you are currently targeting.\n\nNow you can do a container build. Here is an example `Containerfile`\nthat layers a single package from EPEL:\n\n```\nFROM scratch\n#Enable EPEL (more info at https://docs.fedoraproject.org/en-US/epel/ ) and install htop\nRUN rpm-ostree install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \u0026\u0026 \\\n    rpm-ostree install podman-tui \u0026\u0026 \\\n    ostree container commit\n```\n\nNote that in RHCOS 4.16 and newer, you can also use `dnf install` instead of `rpm-ostree install`.\n\nAnd the command to build the container would look like:\n\n\n```\nRHCOS_CONTAINER='quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:....'\nPULL_SECRET=/path/to/pull-secret\npodman build \\\n    --from $RHCOS_CONTAINER \\\n    --authfile $PULL_SECRET \\\n    --file Containerfile    \\\n    --tag quay.io/myorg/myrepo:mytag\n```\n\n# Creating a custom FCOS container Image\n\nThe process is similar to the above except it should be much simpler.\nWith a Containerfile like:\n\n```\nFROM scratch\nRUN dnf install -y podman-tui \u0026\u0026 \\\n    dnf clean all \u0026\u0026 \\\n    ostree container commit\n```\n\n```\nFCOS_CONTAINER='quay.io/fedora/fedora-coreos:stable'\npodman build \\\n    --from $FCOS_CONTAINER \\\n    --file Containerfile    \\\n    --tag quay.io/myorg/myrepo:mytag\n```\n\n# Creating disk boot images from the container image\n\nFirst, we need to convert the image to an OCI archive:\n\n```\n# to pull from local storage\nskopeo copy containers-storage:quay.io/myorg/myrepo:mytag oci-archive:my-custom-coreos.ociarchive\n# OR to pull from a registry\nskopeo copy --authfile /path/to/pull-secret docker://registry.com/org/repo:latest oci-archive:./my-custom-coreos.ociarchive\n```\n\nYou can now take that ociarchive and create a disk image for a\nplatform (i.e. `qemu`, `metal` or `gcp`). First you need an\nenvironment to run OSBuild in. Right now this needs to be a\nfully up to date Fedora 41 machine with SELinux in permissive\nmode and some software installed:\n\n```\nsudo dnf update -y\nsudo setenforce 0\nsudo sed -i -e 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config\nsudo dnf install -y osbuild osbuild-tools osbuild-ostree podman jq xfsprogs \\\n         e2fsprogs dosfstools genisoimage squashfs-tools erofs-utils syslinux-nonlinux \n```\n\nNow you should be able to generate an image with something like:\n\n```\nociarchive=/path/to/my-custom-coreos.ociarchive\nplatform=qemu\nsudo ./custom-coreos-disk-images.sh --ociarchive $ociarchive --platforms $platform\n```\n\nNOTE: If building a Fedora CoreOS image add the `--osname=fedora-coreos` argument to the above command.\n\nWhich will create the file `my-custom-coreos.ociarchive.x86_64.qcow2` in\nthe current working directory that can then be used.\n\nAnother example, this time generating live artifacts (ISO/PXE):\n\n```\nociarchive=/path/to/my-custom-coreos.ociarchive\nplatform=live\nsudo ./custom-coreos-disk-images.sh --ociarchive $ociarchive --platforms $platform\n```\n\nWill create the following files:\n\n- `my-custom-coreos-live-initramfs.x86_64.img`\n- `my-custom-coreos-live-iso.x86_64.iso`\n- `my-custom-coreos-live-kernel.x86_64`\n- `my-custom-coreos-live-rootfs.x86_64.img`\n\n# Using the container image in an OpenShift cluster\n\nYou will also want to [push](https://docs.podman.io/en/latest/markdown/podman-push.1.html)\nthe custom container image to a registry and point OpenShift at it using a\nMachineConfig with the `osImageURL` field set to the image. Otherwise, upon\nbooting, the node will immediately be switched to the default OS image for\nthe target OpenShift version.\n\nCreate a MachineConfig like the following:\n\n```yaml\napiVersion: machineconfiguration.openshift.io/v1\nkind: MachineConfig\nmetadata:\n  labels:\n    machineconfiguration.openshift.io/role: worker \n  name: custom-image\nspec:\n  osImageURL: example.com/my/custom-image@sha256... \n```\n\nIf scaling up, you can specify this MachineConfig as usual using `oc apply -f`.\n\nIf installing a cluster, you can specify the MachineConfig at that point so\nthat it's part of the initial bootstrapping. For examples of this, see the\ndocumentation at:\n\nhttps://docs.openshift.com/container-platform/4.17/installing/installing_bare_metal/installing-bare-metal.html#installation-user-infra-generate-k8s-manifest-ignition_installing-bare-metal\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreos%2Fcustom-coreos-disk-images","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreos%2Fcustom-coreos-disk-images","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreos%2Fcustom-coreos-disk-images/lists"}