Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Also trying to see if can run podman in container because that may have more hopes of building images within an image than docker. Try kubectl exec it podman priv – sh, Then try to build an image.
  2. For this to work, need img with podman installed, and need to be root user, and security context privileged: true. 

    Code Block
    languagebash
    linenumberstrue
    collapsetrue
    [root@rocky9-testd /]# cd build/
    [root@rocky9-testd build]# ls
    __pycache__  asyn  epics-base  start_build.py  start_test.py
    [root@rocky9-testd build]# vim Dockerfile
    [root@rocky9-testd build]# podman build -t docker.io/pnispero/rocky9-env:podman -f Dockerfile .
    Successfully tagged docker.io/pnispero/rocky9-env:podman
    Successfully tagged localhost/pnispero/rocky9-env:podman
    6dea88dccb6a6b4ff9116c7215a089f7c865613d4932fc03eeae4b25baad5996
    [root@rocky9-testd build]# podman images
    REPOSITORY                     TAG         IMAGE ID      CREATED             SIZE
    docker.io/pnispero/rocky9-env  podman      6dea88dccb6a  About a minute ago  984 MB
    localhost/pnispero/rocky9-env  podman      6dea88dccb6a  About a minute ago  984 MB
    # The following is needed for me to push on pnispero/ on dockerhub
    [root@rocky9-testd build]# podman login docker.io
    Username: pnispero
    Password:
    Login Succeeded!
    [root@rocky9-testd build]# podman push docker.io/pnispero/rocky9-env:podman
    Getting image source signatures
    Copying blob 7c554e5c0228 done   |
    Copying blob 9e3fa8fc4839 done   |
    Copying blob 22514acd460a done   |
    Copying blob d3c9bab34657 done   |
    Copying blob e489bb4f45f2 done   |
    Copying blob 446f83f14b23 skipped: already exists
    Copying blob 9142ea245948 done   |
    Copying blob a9ebe5aa7e2b done   |
    Copying blob c776803672c2 done   |
    Copying blob f2f869ceb9a5 done   |
    Copying blob 7f312795052b done   |
    Copying config 6dea88dccb done   |
    Writing manifest to image destination

    Since confirmed it worked, we can have buildscript generate the Dockerfile, send it over to the artifact storage, then start another container on ad-build that is root/privliged so it can build the image from the Dockerfile and push to the registry. 

  3. Update: Found a way to use podman to build image WITHOUT root user or privleged. See podman-test.yaml
    Possible workflow: Buildscript generate Dockerfile → api request to artifact storage to build → artifact storage starts container to build Dockerfile.
    TODO: We can make the rest api ourselves, (django/flask/fastapi framework, and swagger ui for doc?) 
    This artifact storage process/container should have logic to build dockerfile images, and components themselves. It'll be a middle man accepting client requests, and starting up containers to do its work.
    Then the artifact storage container can just return the filepath to copy the built components from
    Come up with api definitions and what we need, then go over with Jerry, and see if we should use django or flask
    authenticate rest api with api key to pass to build containers.

    1. Resource: How to use Podman inside of Kubernetes | Enable Sysadmin (redhat.com)
      How to run systemd in a container | Red Hat Developer