-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe the bug
Docker image from docker hub seems to be flawed in some way that causes az storage blob sync to fail, the issue does not appear when running the command without docker. Details below.
Command Name
az storage blob sync
Errors:
Azcopy command: ['/root/bin/azcopy', 'sync', 'my-dir', 'https://mytestaccount.blob.core.windows.net/my-container/?se=2019-08-31T12%3A14%3A30Z&sp=rwdlacup&sv=2018-03-28&ss=b&srt=sco&sig=GUi3e6WrUDHGYtBYAgKZVOq2CPyIVbP2PIV4YHQMaek%3D', '--delete-destination', 'true']
The command failed with an unexpected error. Here is the traceback:
[Errno 2] No such file or directory: '/root/bin/azcopy': '/root/bin/azcopy'
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 603, in execute
raise ex
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 661, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 652, in _run_job
cmd_copy.exception_handler(ex)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 248, in new_handler
handler(ex)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 191, in handler
raise ex
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 631, in _run_job
result = cmd_copy(params)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 305, in __call__
return self.handler(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 485, in default_command_handler
return op(**command_args)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/azcopy.py", line 112, in storage_blob_sync
azcopy.sync(source, _add_url_sas(destination, azcopy.creds.sas_token), flags=['--delete-destination', 'true'])
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/azcopy/util.py", line 74, in sync
self.run_command(['sync', source, destination] + flags)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/azcopy/util.py", line 62, in run_command
subprocess.call(args, env=dict(os.environ, **env_kwargs))
File "/usr/local/lib/python3.6/subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/local/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/root/bin/azcopy': '/root/bin/azcopy'
To Reproduce:
Run this command with any valid storage account:
docker run --rm -it -e AZURE_STORAGE_CONNECTION_STRING="..." microsoft/azure-cli az storage blob sync --container my-container --source my-dir
Expected Behavior
Proceed without fatal error.
Environment Summary
Linux-5.0.0-20-generic-x86_64-with
Python 3.6.4
Shell: bash
azure-cli 2.0.72
Image: microsoft/azure-cli:latest
Digest: sha256:5510861af13e65ad303c0cfb6dfaaba35385c794e84e4d5c3855aaf6df2eb511
Note: I took me some time to report the issue, I noticed the behavior on latest image some time ago, the cli version was 2.0.67 then (which itself is probably not that relevant, but might point to the Dockerfile version).
Additional remarks
As far as I could investigate the issue, it seems the Alpine distribution, that docker image is based on, is missing some environment components.
Adding line below to the Dockerfile in my case fixed the issue:
RUN apk add --no-cache libc6-compat