Open ajitkumar0 opened 3 months ago
Thank you for opening this issue, we will look into it.
You should not run a RHEL7.6 script on UBI9.
Please follow this guide to install CLI: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?branch=live&pivots=dnf
I tried following https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?branch=live&pivots=dnf in below manner, but this is also failing.
FROM registry.access.redhat.com/ubi9/ubi:latest
RUN dnf install -y gcc gcc-c++ make ncurses patch wget tar zlib zlib-devel \ bzip2 bzip2-devel xz xz-devel sqlite sqlite-devel openssl-devel libffi-devel perl
RUN cd /tmp \ && wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz \ && tar -xzf openssl-1.1.1d.tar.gz \ && cd openssl-1.1.1d \ && ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \ && make \ && make install \ && echo "/usr/local/ssl/lib" > /etc/ld.so.conf.d/openssl-1.1.1d.conf \ && ldconfig
ENV PYTHON_VERSION=3.6.9 RUN PYTHON_SRC_DIR=$(mktemp -d) \ && wget -qO- https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz | tar -xz -C "$PYTHON_SRC_DIR" \ && cd $PYTHON_SRC_DIR/Python-$PYTHON_VERSION \ && ./configure --prefix=/usr --with-openssl=/usr/local/ssl \ && make \ && make install \ && rm -rf $PYTHON_SRC_DIR
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc \ && dnf install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm
RUN dnf install -y azure-cli
RUN rm -rf /tmp/*
Describe the bug
As RUN curl -sL https://azurecliprod.blob.core.windows.net/rhel7_6_install.sh | bash is erroring out with below error 2024-05-29T21:44:41.1417666Z 232.2 Traceback (most recent call last): 2024-05-29T21:44:41.1417955Z 232.2 File "/usr/bin/yumdownloader", line 76, in
2024-05-29T21:44:41.1418217Z 232.2 from dnf.cli import main
2024-05-29T21:44:41.1418507Z 232.2 ModuleNotFoundError: No module named 'dnf'
2024-05-29T21:44:41.1418869Z 232.2 error: File not found by glob: azure-cli-*.rpm
Hence tried to create using below code. But it did not work in both cases.
Use UBI 9 as the base image
FROM registry.access.redhat.com/ubi9/ubi:latest
Install necessary tools and dependencies
RUN dnf install -y gcc gcc-c++ make ncurses patch wget tar zlib zlib-devel \ bzip2 bzip2-devel xz xz-devel sqlite sqlite-devel openssl-devel libffi-devel perl
Build and install OpenSSL from source
RUN cd /tmp \ && wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz \ && tar -xzf openssl-1.1.1d.tar.gz \ && cd openssl-1.1.1d \ && ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \ && make \ && make install \ && echo "/usr/local/ssl/lib" > /etc/ld.so.conf.d/openssl-1.1.1d.conf \ && ldconfig
Set Python version and build Python from source
ENV PYTHON_VERSION=3.6.9 RUN PYTHON_SRC_DIR=$(mktemp -d) \ && wget -qO- https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz | tar -xz -C "$PYTHON_SRC_DIR" \ && cd $PYTHON_SRC_DIR/Python-$PYTHON_VERSION \ && ./configure --prefix=/usr --with-openssl=/usr/local/ssl \ && make \ && make install \ && rm -rf $PYTHON_SRC_DIR
Import the Microsoft repository key and add the repository
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc \ && dnf install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm
Install the Azure CLI
RUN dnf install -y azure-cli
Clean up temporary files
RUN rm -rf /tmp/*
Related command
Use UBI 9 as the base image
FROM registry.access.redhat.com/ubi9/ubi:latest
Install necessary tools and dependencies
RUN dnf install -y gcc gcc-c++ make ncurses patch wget tar zlib zlib-devel \ bzip2 bzip2-devel xz xz-devel sqlite sqlite-devel openssl-devel libffi-devel perl
Build and install OpenSSL from source
RUN cd /tmp \ && wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz \ && tar -xzf openssl-1.1.1d.tar.gz \ && cd openssl-1.1.1d \ && ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \ && make \ && make install \ && echo "/usr/local/ssl/lib" > /etc/ld.so.conf.d/openssl-1.1.1d.conf \ && ldconfig
Set Python version and build Python from source
ENV PYTHON_VERSION=3.6.9 RUN PYTHON_SRC_DIR=$(mktemp -d) \ && wget -qO- https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz | tar -xz -C "$PYTHON_SRC_DIR" \ && cd $PYTHON_SRC_DIR/Python-$PYTHON_VERSION \ && ./configure --prefix=/usr --with-openssl=/usr/local/ssl \ && make \ && make install \ && rm -rf $PYTHON_SRC_DIR
Import the Microsoft repository key and add the repository
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc \ && dnf install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm
Install the Azure CLI
RUN dnf install -y azure-cli
Clean up temporary files
RUN rm -rf /tmp/*
Errors
7 202.1 (cd /usr/lib/pkgconfig; ln -s python-3.6.pc python-3.6m.pc); \
7 202.1 fi
7 202.1 rm -f /usr/bin/python3-config
7 202.1 (cd /usr/bin; ln -s python3.6-config python3-config)
7 202.1 rm -f /usr/lib/pkgconfig/python3.pc
7 202.1 (cd /usr/lib/pkgconfig; ln -s python-3.6.pc python3.pc)
7 202.1 rm -f /usr/bin/idle3
7 202.1 (cd /usr/bin; ln -s idle3.6 idle3)
7 202.1 rm -f /usr/bin/pydoc3
7 202.1 (cd /usr/bin; ln -s pydoc3.6 pydoc3)
7 202.1 rm -f /usr/bin/2to3
7 202.1 (cd /usr/bin; ln -s 2to3-3.6 2to3)
7 202.1 rm -f /usr/bin/pyvenv
7 202.1 (cd /usr/bin; ln -s pyvenv-3.6 pyvenv)
7 202.1 if test "x" != "x" ; then \
7 202.1 rm -f /usr/bin/python3-32; \
7 202.1 (cd /usr/bin; ln -s python3.6-32 python3-32) \
7 202.1 fi
7 202.1 rm -f /usr/share/man/man1/python3.1
7 202.2 (cd /usr/share/man/man1; ln -s python3.6.1 python3.1)
7 202.2 if test "xupgrade" != "xno" ; then \
7 202.2 case upgrade in \
7 202.2 upgrade) ensurepip="--upgrade" ;; \
7 202.2 install|*) ensurepip="" ;; \
7 202.2 esac; \
7 202.2 ./python -E -m ensurepip \
7 202.2 $ensurepip --root=/ ; \
7 202.2 fi
7 202.9 make: *** [Makefile:1102: install] Error 139
executor failed running [/bin/sh -c PYTHON_SRC_DIR=$(mktemp -d) && wget -qO- https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz | tar -xz -C "$PYTHON_SRC_DIR" && cd $PYTHON_SRC_DIR/Python-$PYTHON_VERSION && ./configure --prefix=/usr --with-openssl=/usr/local/ssl && make && make install && rm -rf $PYTHON_SRC_DIR]: exit code: 2
Issue script & Debug output
RUN curl -sL https://azurecliprod.blob.core.windows.net/rhel7_6_install.sh
Expected behavior
Should allow to install azure cli in redhat ubi 9
Environment Summary
az --version
Additional context
No response