How to mount a virtual disk inside Azure Container Instance?

  Kiến thức lập trình

I have an Azure SMB File Share which gets mounted inside my Azure Container Instance. Inside the File Share, there’s a Virtual Disk file VHD.img which I want to mount.

My container instance Dockerfile ends with this command to mount the VHD and start my application:

CMD ["/bin/bash", "-c", "sudo mount -t auto -o loop /mnt/fileshare/VHD.img /home/user/users/; gunicorn ... [redacted]"]

However, I get this message in the logs:

mount: /home/user/users/: mount failed: Operation not permitted.

And when I connect to my container instance I also cannot mount that VHD no matter what, not even as root, it always says operation not permitted.

My container instance is deployed with –privileged and –add-capabilities ALL, so I should be able to mount, right?

Now some context on why I’m trying to do this:

My application deals with reading and writing lots of small files. I noticed it was performing too slow (like 10 seconds to load the contents of a directory 5MB to memory, while locally it took <0.01 seconds). The Azure Storage diagnostics said my application was indeed too slow and linked me to this documentation, which told me to mount a VHD, which I am trying to do.

LEAVE A COMMENT