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

1

2

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

Spavined answered 26/5, 2022 at 8:3 Comment(2)
Can you edit the question to include the Go code that produces that error? What directory are you trying to os.Mkdir()? What's the main container CMD in the Dockerfile, and is there more important setup you're not showing?Jennyjeno
@DavidMaze There is no go code I'm using.. azcopy utility is probably using Golang and hence the error message.Spavined
S
2

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.

Spavined answered 26/5, 2022 at 10:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.