Skip to content
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

az cli install script fails for alpine #7437

Closed
pragyamehta opened this issue Sep 27, 2018 · 3 comments
Closed

az cli install script fails for alpine #7437

pragyamehta opened this issue Sep 27, 2018 · 3 comments

Comments

@pragyamehta
Copy link

Running the az cli install script inside Alpine docker image fails with multiple errors

To Reproduce
use the below Dockerfile

FROM alpine:3.7
RUN apk add --update --no-cache bash python3 libffi openssl curl
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN curl -L https://aka.ms/InstallAzureCli | bash

Expected behavior
Image is successfully built and container has az installed in it

Environment summary
Docker on windows
docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:21:34 2018
OS/Arch: windows/amd64
Experimental: false

Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:29:02 2018
OS/Arch: linux/amd64
Experimental: false

Additional context
I see the below errors :

  1. mktemp expects a template that ends with XXXXXX and not XXXX
  2. If I manually edit the script and run, I see the error "./install-azure-cli.sh: line 33: /dev/tty: No such device or address"
  3. If I manually run the install script inside the container without "< /dev/tty", I get the error :
    Command "/root/lib/azure-cli/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-m1zf6io_ --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel "cffi>=1.4.1; python_implementation != 'PyPy'"" failed with error code 1 in None
    Traceback (most recent call last):
    File "./azure_cli_install_tmp_PeaOmb", line 370, in
    main()
    File "./azure_cli_install_tmp_PeaOmb", line 356, in main
    install_cli(install_dir, tmp_dir)
    File "./azure_cli_install_tmp_PeaOmb", line 140, in install_cli
    exec_command(cmd)
    File "./azure_cli_install_tmp_PeaOmb", line 100, in exec_command
    subprocess.check_call(command_list, cwd=cwd, env=env)
    File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/root/lib/azure-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmputs58c2j', 'azure-cli', '--upgrade']' returned non-zero exit status 1.
@yugangw-msft
Copy link
Contributor

CC: @troydai
I don't believe install-azure-cli.sh is supported any more for linux.
You best option is to follow the docker file

@mrumpf
Copy link

mrumpf commented Dec 13, 2018

The fix is just to make the "XXXX" longer by 2 "X" :)
The alpine mktemp expects the TEMPLATE to have 6x"X": "XXXXXX":

BusyBox v1.28.4 (2018-07-17 15:21:40 UTC) multi-call binary.

Usage: mktemp [-dt] [-p DIR] [TEMPLATE]

Create a temporary file with name based on TEMPLATE and print its name.
TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).
Without TEMPLATE, -t tmp.XXXXXX is assumed.

	-d	Make directory, not file
	-q	Fail silently on errors
	-t	Prepend base directory name to TEMPLATE
	-p DIR	Use DIR as a base directory (implies -t)
	-u	Do not create anything; print a name

Base directory is: -p DIR, else $TMPDIR, else /tmp

@mrumpf
Copy link

mrumpf commented Dec 13, 2018

So the fix is like this:

curl -L https://aka.ms/InstallAzureCli | sed -e "s/XXXX/XXXXXX/g" | bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants