Shared mount not visible for PSU in Docker

Product: PowerShell Universal
Version: 3.8.12

I have a mount on my docker host and in compose I map that mount via a volume.

When I SSH into the container, I can see the shared device/mount and browse it.

But when I start a terminal or write a script to run, the results tell me the mount is not there.

So I mount on my docker host:

That works.

I have this in my compose file dor PSU:

  • /mnt/shield:/shield

When I SSH into the container and do:
ls /shield

I get results as expected.

When I use a terminal in PSU and do:
ls /shield
Or when I write a script in PSU and run it:
Get-ChildItem /shield
(or have it run ‘ls /shield’)

It tells me in errors that /shield doesn’t exist.

Is there some some way to have the mount accessible in the PSU context of scripts and dashboards?

Hi @Steven,

I have tested mounting a folder to /shield on my test environment, and it appears to create the folder and mount it.

  • How are you deploying your container?
  • Are you able to share your compose snippet?
  • Does mounting to the /root folder work as expected?

Hi Matt,

I deploy docker containers on a dedicated docker host running on Alpine.
I deploy them via docker compose.

      - type: bind
        source: /mnt/shield
        target: /shield

The odd thing is that in PSU context this fails, the container itself, where PSU is running on, sees that mount just fine, it is PSU that is not seeing it.

Any idea what could be happening?

Bind mounts have been around since the early days of Docker. Bind mounts have limited functionality compared to volumes.

When I tested this, I used the following volume mounts:

      - /docker/psu3/:/root
      - /docker/psu3/:/shield

The /docker/psu3/ folder mounted to both the root and the shield folders.

What happens if you replace your bind mount for volume mounts?

More examples of working Compose scripts are available here.

Hi Matt,

I’m not sure what happened but I found a way to make it work but I already tested that last week and I could have sworn it did not work at the time.

I will give my setup so should anyone need the same type of setup/access then this will be a head start for that.

On the Host docker server you mount the remote share you want to access:

# Create the mount-point (folder), this will be your access point in filesystem usage
mkdir /mnt/shield

# Now mount the share
mount -t cifs -o username=<username>,password=<password>,iocharset=utf8,file_mode=0777,dir_mode=0777 //<IP of the remote server></path to the remote share> <mountname>

#Example how I did it:
#mount -t cifs -o username=MyName,password=MyPassword,iocharset=utf8,file_mode=0777,dir_mode=0777 // /mnt/shield/
#Note: pay attention that there is a speace between "</path to the remote share>" and "<mountname>"

# Test the mount/share
ls -l /mnt/shield

In your docker compose file you ‘bind’ mount the volume, this is a little bit different then a normal volume command in the compose file:

  # Normal Volume mount, this one exposes the 'root' folder to the host folder system so you have a persistent PSU folder
  - ./universal-data:/root
  # This Volume will be mounted via 'bind' as the mounted folder hosted on the docker host is not a typical normal folder but itself is a redirection to the remote server where the actual folder is located
  - type: bind
    source: /mnt/shield
    target: /shield

You will now have access to the folders and files on that remote server.

Here is an overview of how things are connected:

Servers and Applications involved:

Docker Host Alpine (DHA)
Remote Media Server (RMS)
PSU Container Server (PCS)

DHA mounts a shared folder located on RMS
DHA has a compose file that maps this DHA mounted folder via a ‘bind’ command
PCS has access on SSH level, i.e. SSH into container and list all files from ‘/shield’
PCS as an application can also ‘see’ all files as listed in folder ‘/shield’

This should roughly tell you how to configure and work with remote shared folders on a docker host and the containers running on top of it.

1 Like