If you need to move files from a container and you are not using WEBSITES_ENABLE_APP_SERVICE_STORAGE, you will notice you cannot see the files when you SSH into the Kudu container.  In order to get these files into Kudu to easily transfer them you can use the linux tool ‘ncftp’. 


In this example we will get the entire wwwroot directory.  SSH into the container and install ncftp and zip as follows:

i. SSH into the Docker container and run the following to get into the correct directory and install zip and ncftp

cd /home/site/wwwroot
apk update
apk add zip
apk add ncftp
zip -r wwwroot.zip .  (don’t forget the trailing “.”).

ii. In the Azure Portal, go to the Overview blade for the app and press “Get publish profile”
iii. Find the username and password as well as the ftp site in that publish profile.  Make sure you add the username in a single quote when connecting using ncftp as shown below.

ncftp -u ‘jefflinuxtest\$jefflinuxtest’ ftp://waws-prod-bay-081.ftp.azurewebsites.windows.net site

iv. Enter your password then perform the following.

cd site/wwwroot
put wwwroot.zip.

v. Sample output provided below.

c6b6f3bd43fd:/home/site/wwwroot# ncftp -u ‘jefflinuxtest\$jefflinuxtest’ ftp
://waws-prod-bay-081.ftp.azurewebsites.windows.net site
NcFTP 3.2.6 (Dec 04, 2016) by Mike Gleason (http://www.NcFTP.com/contact/).
Connecting to…
Microsoft FTP Service
Logging in…
Password requested by for user “jefflinuxtest\$jefflinuxtest”.

    Password required

Password: ************************************************************

User logged in.
Logged in to waws-prod-bay-081.ftp.azurewebsites.windows.net.
Current remote directory is /.
ncftp / > cd site/wwwroot
ncftp /site/wwwroot > put wwwroot.zip
wwwroot.zip:                                            47.61 MB   42.56 MB/s
ncftp /site > exit

        Thank you for using NcFTP Client.
         If you find it useful, please consider making a donation!
vi. Check that /home/site contains the wwwroot.zip file using KUDU/Bash.

vii.  Now simply use the vfs feature of kudu to download the files!   https://github.com/projectkudu/kudu/wiki/REST-API    In this example go to https://jsanderscontainerl.scm.azurewebsites.net/api/vfs/site/wwwroot/wwwroot.zip in a browser and you can download the file!

Comments (1)

  1. Pingback: Azure Weekly: February 5, 2019 | Build Azure

Leave a comment

Your email address will not be published. Required fields are marked *