The following steps can be used to mount a SMB share into an existing container.
1. Push your application without any SMB volumes mounted. When it starts,
cf ssh
into the app.
2. Run
net use
to list attached shares. You should see none.
3. Run
net use \\<ip>\<share> /u:<user> <pass>
, where
<ip>
is the IP of your SMB server,
<share>
is the name of the volume being shared, and
<user>
or
<pass>
are the credentials for the volume.
For example:
net use \\10.10.10.10\public /u:myuser hackm3
4. Run
net use
again. You should now see your SMB volume mounted. Please note that you must use an IP address and not a DNS name. This is a limitation in the current implementation which will likely go away in a future release.
IMPORTANT NOTE: If your application needs the SMB volume to be mounted when the application starts or you would like to automate the process, please follow these additional steps:
6. Create a .
profile.bat
script at the root of your application. This should be the directory from which you are running
cf push
or the directory you set with the
cf push -p
argument.
7. In the script, add the following:
timeout 2
net use \\<ip>\<share> /u:<user> <pass>
8. Save the file & push your application. The .profile.bat
script should run prior to your application and mount the volume.