Search code examples
azuredockerazcopy

azcopy installation on container error - "panic: mkdir : no such file or directory"


I'm trying run azcopy v10 inside a container to export some files to azure blob storage.

To include azcopy utility in the container image, I have use below instruction in the Dockerfile.

 RUN /bin/bash -c 'wget https://azcopyvnext.azureedge.net/release20220511/azcopy_linux_amd64_10.15.0.tar.gz && \
  tar -xvzf azcopy_linux_amd64_10.15.0.tar.gz && \
  cp ./azcopy_linux_amd64_*/azcopy /usr/bin/ && \
  chmod 775 /usr/bin/azcopy && \
  rm azcopy_linux_amd64_10.15.0.tar.gz && \
  rm -rf azcopy_linux_amd64_*'

However seeing below error when I run the azcopy command.

ns@master-0:/opt/myapp$ azcopy
panic: mkdir : no such file or directory

goroutine 1 [running]:
github.com/Azure/azure-storage-azcopy/v10/common.PanicIfErr(...)
        /home/vsts/work/1/s/common/lifecyleMgr.go:674
main.main()
        /home/vsts/work/1/s/main.go:55 +0x4c5

Not sure which file/dir the error message is referring to. Any suggestions will be helpful.

Edit 1: updated download link of azcopy to a static version rather than download a latest version


Solution

  • I found the issue in github: https://github.com/Azure/azure-storage-azcopy/issues/903

    I was able to get azcopy working by setting below env variable as mentioned in the github link.

    mkdir /opt/myapp/azlogs
    export AZCOPY_LOG_LOCATION=/opt/myapp/azlogs
    

    This is basically the log location for azcopy. I'm thinking of making this env variable part of the image rather than having to type it out every time.

    EDIT 1: I came across another error.

    panic: mkdir plans: permission denied
    

    looks like azcopy wants to create a plans directory on current working dir. So ensure that the user you are running azcopy as has permissions to create a new folder on the current working dir.