0

I am trying to Mount the CIFS Share Drive(Azure Storage File Service) as root user, But still its not allowing to mount and throwing Error:

mount: permission denied (are you root?)

Please find the below Docker File and Entry Point File.

Docker File

FROM alpine:latest

USER root

RUN apk update \
    && apk add --no-cache ca-certificates wget

RUN apk add postgresql-client cifs-utils

COPY ./mount-drive.sh /tmp/mount-drive.sh 

RUN chmod +X /tmp/mount-drive.sh 

RUN apk --no-cache add sudo

ENTRYPOINT [ "sh", "/tmp/mount-drive.sh" ]

Entry Point File

mkdir /mnt/test

if [ ! -d "/etc/smbcredentials" ]; then
    mkdir /etc/smbcredentials
fi

if [ ! -f "/etc/smbcredentials/<storageaccountname>.cred" ]; then
    sh -c 'echo "username=<storageaccountname>" >> /etc/smbcredentials/<storageaccountname>.cred'
    sh -c 'echo "password=PASSWORD" >> /etc/smbcredentials/<storageaccountname>.cred'
fi

chmod 600 /etc/smbcredentials/<storageaccountname>.cred

sh -c 'echo "//<storageaccountname>.file.core.windows.net/test /mnt/test cifs nofail,vers=3.0,credentials=/etc/smbcredentials/<storageaccountname>.cred,dir_mode=0777,file_mode=0777,serverino" >> /etc/fstab'


sudo -u root mount --t cifs //<storageaccountname>.file.core.windows.net/test /mnt/test -o vers=3.0,credentials=/etc/smbcredentials/<storageaccountname>.cred,dir_mode=0777,file_mode=0777,serverino

  • This should help - https://stackoverflow.com/questions/27989751/mount-smb-cifs-share-within-a-docker-container – Raman Sailopal Nov 25 '20 at 09:31
  • Does this answer your question? [Mount SMB/CIFS share within a Docker container](https://stackoverflow.com/questions/27989751/mount-smb-cifs-share-within-a-docker-container) – Raman Sailopal Nov 25 '20 at 09:32

0 Answers0