-
Notifications
You must be signed in to change notification settings - Fork 9
Run install commands within image container #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
lgtm |
|
Do you have a way to test this? |
|
Sure... git clone -b trcotton/layer-refactor https://github.com/OpenCHAMI/image-builder.gitchange to image-builder: cd image-builder/build it: podman build -t image-builder:test -f dockerfiles/dnf/Dockerfile .create a test folder: mkdir testMake a test config in options:
layer_type: 'base'
name: 'suse-base'
publish_tags:
- '15.7'
pkg_manager: 'zypper'
parent: 'registry.suse.com/bci/bci-base:15.7'
publish_local: true
packages:
- cloud-init
- python3
- vim
- chronyRun it: podman run \
--device /dev/fuse \
-it \
--name image-builder \
--rm -v $PWD/tests:/data image-builder:test \
image-build --log-level INFO --config /data/suse.yaml |
|
Not working for me. Error: Image definition: |
|
I think got a different error running... podman run \
--device /dev/fuse \
-it \
--name image-builder \
--rm -v $PWD/test:/data image-builder:test \
image-build --log-level INFO --config /data/suse.yamlThe error: -------------------BUILD LAYER--------------------
ERROR - Trying to pull registry.suse.com/bci/bci-base:15.7...
ERROR - Getting image source signatures
ERROR - Copying blob sha256:974449b21a84067bddbf51f286c6ba10084622e04303a6933c31d6af3f7eb475
ERROR - Error: copying system image from manifest list: writing blob: adding layer with blob "sha256:974449b21a84067bddbf51f286c6ba10084622e04303a6933c31d6af3f7eb475": processing tar file(potentially insufficient UIDs or GIDs available in user namespace (requested 0:15 for /etc/shadow): Check /etc/subuid and /etc/subgid if configured locally and run "podman system migrate": lchown /etc/shadow: invalid argument): exit status 1
Error building layer: Command '['buildah', 'from', '--name', 'suse-base20250522222318', 'registry.suse.com/bci/bci-base:15.7']' returned non-zero exit status 1. |
|
Testing fails for me with chown: changing ownership of '/home/builder/config.yaml': Permission denied
Error: the file 'config.yaml' does not exist.Confirmed working with |
|
How are you running it? |
|
This commit: ae53d30 |
20236bf to
b5651bf
Compare
| --cap-add=SETGID \ | ||
| --security-opt seccomp=unconfined \ | ||
| --security-opt label=disable \ | ||
| --userns=keep-id \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| --userns=keep-id \ | |
| --userns=keep-id:uid=1000,gid=1000 \ |
I've been using this to ensure my outside UID is mapped to builder so that builder can access things like 0600 files.
|
Tried testing and got this: This was my command: |
e34c4b8 to
9de355d
Compare
…image (not scratch) then use the package manager installed in the image Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
… build container to work better with subuid/subgid mapping Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
This reverts commit 3b6813d. Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
This reverts commit 5e67b00. Signed-off-by: Travis Cotton <trcotton@lanl.gov>
This reverts commit eba24b2. Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Co-authored-by: treydock <treydock@gmail.com> Signed-off-by: Travis Cotton <trcotton@lanl.gov>
9de355d to
2d960dc
Compare
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
|
I built this with: and it builds. But there's a Python import error when I try running the container: |
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
Tests✅ Building Rocky 9 image from scratch options:
layer_type: 'base'
name: 'rocky-base'
publish_tags: '9.5'
pkg_manager: 'dnf'
parent: 'scratch'
publish_registry: '172.16.0.254:5050/test'
registry_opts_push:
- '--tls-verify=false'
repos:
- alias: 'Rocky_9_BaseOS'
url: 'http://<dist_server>/repo/pub/rocky/9/BaseOS/x86_64/os'
gpg: 'http://<dist_server>/gpg/RPM-GPG-KEY-Rocky-9'
- alias: 'Rocky_9_AppStream'
url: 'http://<dist_server>/repo/pub/rocky/9/AppStream/x86_64/os'
gpg: 'http://<dist_server>/gpg/RPM-GPG-KEY-Rocky-9'
- alias: 'Rocky_9_CRB'
url: 'http://<dist_server>/repo/pub/rocky/9/CRB/x86_64/os'
gpg: 'http://<dist_server>/gpg/RPM-GPG-KEY-Rocky-9'
- alias: 'Epel'
url: 'http://<dist_server>/repo/pub/rocky/epel/9/Everything/x86_64'
gpg: 'http://<dist_server>/gpg/RPM-GPG-KEY-EPEL-9'
package_groups:
- 'Minimal Install'
- 'Development Tools'
packages:
- kernel
- wget
- dracut-live
- kitty-terminfo
cmds:
- cmd: 'dracut --add "dmsquash-live livenet network-manager" --kver $(basename /lib/modules/*) -N -f --logfile /tmp/dracut.log 2>/dev/null'
- cmd: 'echo DRACUT LOG:; cat /tmp/dracut.log'❌ Building from parent image options:
layer_type: 'base'
name: 'compute-base'
publish_tags:
- '9.5'
pkg_manager: 'dnf'
parent: '172.16.0.254:5050/test/rocky-base:9.5'
registry_opts_pull:
- '--tls-verify=false'
# Publish to local S3
publish_s3: 'http://172.16.0.254:9090'
s3_prefix: 'compute/base/'
s3_bucket: 'boot-images'
# Publish to SI registry
publish_registry: '172.16.0.254:5050/test'
registry_opts_push:
- '--tls-verify=false'
packages:
- cloud-init
- python3
- vim
- nfs-utils
- chrony
- cmake3
- dmidecode
- dnf
- efibootmgr
- golang
- ipmitool
- jq
- make
- perf
- rsyslog
- sqlite
- sudo
- tcpdump
- traceroute
- nss_db
- lua-posix
- tcl
- git
- fortune-modError: |
|
The call to Line 97 in 982d6e7
includes image-builder/src/installer.py Line 260 in 982d6e7
need to be updated with those? |
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
synackd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests above pass for DNF. LGTM.
Currently every repo, package, and package group install happens outside the container. This forces you to use the same package manager as the build container (i.e. if you want to use
dnfthen you must usednfin the build container).This change should make it possible to build images with
zypperordnf(and make it easier to add other package managers) regardless of the build container's package manager. The only restriction is that when the parent is "scratch". This will call the scratch based installs which will use the build containers package manager to bootstrap the image.