ec2-image-builder-roadmap icon indicating copy to clipboard operation
ec2-image-builder-roadmap copied to clipboard

[Container image recipes] Support for base image that don't include yum, apt-get nor zypper

Open psantus opened this issue 1 year ago • 0 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Tell us about your request Manage package managers apart from yum, apt-get and zypper

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? I have a docker image (for the sake of the example, it's keyfactor/ejbca-ce:latest).

Trying to apply any component fails, because container_bootstrap.sh provided by aws supports only a limited list of package managers

!/bin/bash -xe

function package_exists() {
    $(type "$1" > /dev/null 2>&1 )
    return $?
}

function install_package() {
    if package_exists yum ; then
        yum install -y -q $1
    elif package_exists apt-get ; then
        apt-get update -y -qq
        apt-get install -y -qq $1
    elif package_exists zypper ; then
        zypper -q install -y $1
    else
        echo "Unable to install package '$1'"
        exit -1
    fi
}

if ! package_exists which ; then
    install_package which
fi

if ! package_exists sudo ; then
    install_package sudo
fi

if ! package_exists curl ; then
    install_package curl
fi

My docker image is based on AlmaLinux mnimal installation, that only embed microdnf as its package manager.

Are you currently working around this issue? Installing YUM as a first step in my Dockerfile.

    FROM {{{ imagebuilder:parentImage }}}
    {{{ imagebuilder:environments }}}
    USER 0
    RUN ["/bin/bash", "-c", "microdnf install yum"]
    {{{ imagebuilder:components }}}
    USER 10001
    EOF

Additional context

Attachments

psantus avatar Jul 03 '23 15:07 psantus