Docker image not working

I’m trying to use the Docker image to run PSU contained and wanting to test it out. The only experience I have with PSU related items is from V2 of PowerShell Universal Dashboard. I have zero experience with Docker.

I tried to follow this guide:

I have this Dockerfile:

FROM ironmansoftware/universal:latest
LABEL description=“Universal - The ultimate platform for building web-based IT Tools”
EXPOSE 5000
VOLUME [“/home/data”]
ENV Data__RepositoryPath /home/data/Repository
ENV Data__ConnectionString /home/data/database.db
ENV UniversalDashboard__AssetsFolder /home/data/UniversalDashboard
ENV Logging__Path /home/data/logs/log.txt
ENTRYPOINT [“./Universal/Universal.Server”]

I build the new (?) image like this:

docker build . --tag=universal-persistent-personal --platform linux/amd64

I then try to start this new image “universal-persistent-personal” from Docker Desktop but the log shows me this fatal error:

[17:03:10 FTL] Fatal error starting PowerShell Universal.
2023-03-04 18:03:10 System.IO.IOException: Function not implemented
2023-03-04 18:03:10 at System.IO.FileSystemWatcher.StartRaisingEvents()
Etc…

Trying to access the image via a browser (http://localhost:5000/) does not work:

Access to localhost was denied
You don’t have authorisation to view this page.
HTTP ERROR 403

I go t the option “–platform linux/amd64” to build an image from some google search on this error as it seems that the building issues I faced are related to the M1 chip. Maybe this is not right, I have no clue tbh.

I tried to run the default image from Ironman Soft itself and had this in the logs:

[17:33:29 FTL] Fatal error starting PowerShell Universal.
2023-03-04 18:33:30 System.IO.IOException: Function not implemented
2023-03-04 18:33:30 at System.IO.FileSystemWatcher.StartRaisingEvents()
Etc…

I got that image from this command:

docker pull ironmansoftware/universal

Seems like this Powershell Universal Docker image will not run for me but I cannot see what I could do to mitigate this? The only thing I can think of is that the server/host needs to be Windows for this to work but this goes against what I thought I knew about Docker, but I could be wrong of course.

When I try the basics, as decribed in the article about Docker and Powershell Universal:

docker pull ironmansoftware/universal
docker run --name ‘PSU’ -it -p 5000:5000 ironmansoftware/universal

I get this error in the console:

WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
docker: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:5000 → 0.0.0.0:0: listen tcp 0.0.0.0:5000: bind: address already in use.
ERRO[0000] error waiting for container: context canceled

Trying to access localhost on port 5000 is not working, just like the tries from Docker Desktop.

Trying another port, as port 5000 seems to be occupied atm:

docker run --name ‘PSU’ -it -p 5001:5001 ironmansoftware/universal

I get this output in the console:

[17:51:35 FTL] Fatal error starting PowerShell Universal.
System.IO.IOException: Function not implemented
at System.IO.FileSystemWatcher.StartRaisingEvents()

So whatever I try, I cannot get this to run as expected.
Any ideas what is wrong or what I must do to get this working?

Product: PowerShell Universal
Version: latest from docker

Docker Desktop
Engine: 20.10.23
Compose: v2.15.1
Credential Helper: v0.7.0
Kubernetes: v1.25.4

MacOS Ventura 13.2.1
Chip Apple M1 Max

Hi @Steven, are you trying to add anything to the container?

If not, then you will not need to re-bulid as @adam has done all the building for you (thanks for this by the way Adam :slight_smile: ).

what platform/stack are you using to deploy your docker container? Linux, windows, docker desktop, azure container instances, aws, etc)

On my laptop I have docker desktop installed and i have the following compose file:

--- yaml
version: "3"
services:
  PowershellUniversal:
    image: ironmansoftware/universal:3.7.14-ubuntu-20.04
    volumes:
      - PSU:/root
    ports:
      - "80:5000"

The image can be found here (apologies if I’m teaching you how to suck eggs):
https://hub.docker.com/r/ironmansoftware/universal/tags?page=1&name=-ubuntu-20.04

I tend you up the version manually and not use the latest tag as I test new versions before pushing to dev in Azure.

If you prefer to use a static volume, you can swap out the PSU volume mapping to something like C:\docker\volumes\psu or where ever your data folder is. Once that is specified, you can open up PowerShell and CD to the location of your docker-compose-yml file. You can run docker-compose up -d and that should give you a container on port 80 to start playing with.

In my opinion, Docker is the way to go for reliability this takes up 400Mb of memory with 1 dashboard out of the box and is easy to revert if you upgrade and need to rollback.

Hi Matt,

Thanks for taking time to try and help me out with this!

I try to use the same as in the Docker page of Powershell Universal:

ironmansoftware/universal:latest

However, for a test I used the Docker image you pointed at:

ironmansoftware/universal:3.7.14-ubuntu-20.04

The host/platform I want to run Docker on is MacOS/Linux.
I might end up on Azure, and there I could choose the OS running the container.

I did make a dockerfile and added the information as described on the PSU webpages for Docker usage:

FROM ironmansoftware/universal:3.7.14-ubuntu-20.04
LABEL description=“Universal - The ultimate platform for building web-based IT Tools”
EXPOSE 6002
VOLUME [“/home/data”]
ENV Data__RepositoryPath /home/data/Repository
ENV Data__ConnectionString /home/data/database.db
ENV UniversalDashboard__AssetsFolder /home/data/UniversalDashboard
ENV Logging__Path /home/data/logs/log.txt
ENTRYPOINT [“./Universal/Universal.Server”]

Built it via this command:

docker build . --tag=universal-persistent-personal

Trying to run it via:

docker run -it --name powershelluniversal --mount source=psudata,target=/home/data --rm -d -p 6002:6002/tcp universal-persistent-personal:latest

It shows the same issue in the log if I look at the container in Docker Desktop:

Fatal error starting PowerShell Universal.
System.IO.IOException: Function not implemented
at System.IO.FileSystemWatcher.StartRaisingEvents()

I am starting to think there is something in the container that is not working on MacOS/Linux, namely the FileSystemWatcher routine. I believe this to be a Windows specific feature?
Edit: I just checked and it seems the FileSystemWatcher class is available on .Net Core/PS7:

$FileSystemWatcher = New-Object System.IO.FileSystemWatcher

However, there is no method called “StartRaisingEvents” and that is the top of the trace:

System.IO.FileSystemWatcher.StartRaisingEvents()

To try and see if I can run PSU on MacOS I Installed PSU and installed the server without Docker, just the basic installation:

Install-Module Universal
Install-PSUServer -AddToPath
Start-PSUServer -Port 6001

I can then access PSU via a browser like it supposed to work and it is all fine as far as I can tell. It is just the Docker image that refuses to start. For some reason I do not get an issue with running FileSystemWatcher or I just am not checking things right. I am still learning where Docker stores it’s files/settings/images and this goes for PSU the same, no idea how it is organised and where stuff is located.

:arrow_forward: One important thing to note if trying to run any service on a port on MacOS:
Ever since MacOS Ventura/Monterey it seems that port 5000 is used by the core MacOS service “AirPlay Reciever”:

So perhaps it is best to not use port 5000 as example anymore as it will conflict with core MacOS functionality.

Hi @Steven,

I can see you are exposing port 6002 though PSU is built to run on 5000. Exposing port 6002 in a build will not work.

I recommend you ignore building your own container while you focus on getting the default config running. Once that is working, you can then begin to make any changes you need.

If your Mac Operating System reserves port 5000 you can always redirect to another port, which is a major feature of docker.

You can see on the final line of my compose script that I redirected port 5000 to port 80. This should work on your Mac.

If port 80 is already taken, then you can change port 80 to any unused port. If you are using docker desktop for mac then you should be able to CD into the folder your compose file is in and do a docker compose up -d and that should bring it up to port 80 or the port you have changed it too.

Whatever port the container uses inside the container will not depend on if your Mac uses that port.

You could have hundreds of PSU instances in a compose script all using port 5000 internally and all you have to do is change port 80 to a unique port.

Hi Matt,

I must admit that I am lost on this Docker setup. I need to read up on it. I have no clue what you mean with “compose”. I just follow the tutorial and try to avoid deviations from it, just because of issues that might popup because you deviate from the guides.

For example, I thought that this:
EXPOSE 6002

would determine the port used for the application (PSU), this is not the case if I understand you right.

For now I am doubting on using Docker as there are 2 issues:

  1. I do not seem to understand Docker and need more technical information
  2. The guides/PSU seem to be problematic with Docker, but this could be related to #1

I have to make a PoC and want to use PSU. Would have loved to use Docker as it would be an additional selling point. If I install PSU directly I can make it work so that helps selling PSU for now.
I will simultaneously try to get Docker and PSU working on my end.

Thanks!

Hi @Steven,

Keep in mind that Adam has already done the build for you. Those steps are for if wish to include that image in other containers. For the purposes of getting this working, you can ignore any build steps or use of Dockerfile.

What I recommend you do to get this up and running is:

  1. Confirm you have docker desktop installed.
  2. Run a Hello World in docker to make sure docker is working correctly. The command docker run hello-world in a terminal should generate output confriming docker is working as expected.
  3. Open up a terminal and attempt to run docker compose verison and see if it returns a version number.

Essentially, docker compose allows you to provide scripts in a yml text file, so you do not have to rely on manual console commands.

Get to that point and ill prepare the next steps for you on your docker journey :slight_smile:

Hi Matt,

I tried to run the hello world command:

docker run hello-world

And I got the proper response:

Hello from Docker!
This message shows that your installation appears to be working correctly.

I executed the compose command:

docker compose version
Docker Compose version v2.15.1

I also tried in Docker Desktop to point directly to the Image and run directly, no rebuilding of any kind or port mapping (so no dockerfile was involved, this should be straight from the repository). Same issue it seems.

I tried this from Docker Desktop:

The results I see:

2023-03-06 17:21:17 [16:21:17 FTL] Fatal error starting PowerShell Universal.
2023-03-06 17:21:17 System.IO.IOException: Function not implemented
2023-03-06 17:21:17 at System.IO.FileSystemWatcher.StartRaisingEvents()
2023-03-06 17:21:17 at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
2023-03-06 17:21:17 at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
2023-03-06 17:21:17 at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
2023-03-06 17:21:17 at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
2023-03-06 17:21:17 at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
2023-03-06 17:21:17 at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
2023-03-06 17:21:17 at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func1 changeTokenProducer, Action changeTokenConsumer) 2023-03-06 17:21:17 at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source) 2023-03-06 17:21:17 at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder) 2023-03-06 17:21:17 at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() 2023-03-06 17:21:17 at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration() 2023-03-06 17:21:17 at Microsoft.Extensions.Hosting.HostBuilder.Build() 2023-03-06 17:21:17 at Universal.Server.Program.<>c__DisplayClass3_0.<Main>b__0(Options o) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Program.cs:line 72 2023-03-06 17:21:18 Unhandled exception. System.IO.IOException: Function not implemented 2023-03-06 17:21:18 at System.IO.FileSystemWatcher.StartRaisingEvents() 2023-03-06 17:21:18 at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed() 2023-03-06 17:21:18 at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value) 2023-03-06 17:21:18 at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher() 2023-03-06 17:21:18 at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter) 2023-03-06 17:21:18 at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter) 2023-03-06 17:21:18 at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0() 2023-03-06 17:21:18 at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func1 changeTokenProducer, Action changeTokenConsumer)
2023-03-06 17:21:18 at Microsoft.Extensions.Configuration.FileConfigurationProvider…ctor(FileConfigurationSource source)
2023-03-06 17:21:18 at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
2023-03-06 17:21:18 at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
2023-03-06 17:21:18 at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
2023-03-06 17:21:18 at Microsoft.Extensions.Hosting.HostBuilder.Build()
2023-03-06 17:21:18 at Universal.Server.Program.<>c__DisplayClass3_0.b__0(Options o) in C:\actions-runner_work\universal\universal\src\Universal.Server\Program.cs:line 72
2023-03-06 17:21:18 at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action1 action)
2023-03-06 17:21:18 at Universal.Server.Program.Main(String args) in C:\actions-runner_work\universal\universal\src\Universal.Server\Program.cs:line 52
2023-03-06 17:21:18 qemu: uncaught target signal 6 (Aborted) - core dumped

This looks like an actual problem with PSU. I wonder if it has to do with running a container on the M1. I’ll have to give it a shot.

That all looks to be working…

Next,

  1. Create a folder called docker and within it create a folder called volumes and within that create one called psu. so, <path>/docker/volumes/psu
  2. In the docker folder create a text file called docker-compose.yml
  3. Inside that text file copy the following code including the spaces and indentation
    --- 
    version: "3"
    services:
      PowershellUniversal:
    	container_name: PowershellUniversal
    	image: ironmansoftware/universal:3.7.14-ubuntu-20.04
    	restart: unless-stopped
    	volumes:
    		- <path>/docker/volumes/psu:/root
    	ports:
    		- "80:5000"
    
    You will need to replace with the path to your docker folder. Feel free to change port 80 if that is in use.
  4. Open up a terminal and CD to your docker folder where your docker-compose.yml file is.
  5. Run the command docker compose up -d
    That should bring up the container

Hi Matt,

I created the folder like so:

/Users/stevenspierenburg/Temp/docker/volumes/psu

This is the yaml file as instructed. I did change the portnumber though as port 80 is occupied.

---
version: "3"
services:
  PowershellUniversal:
  container_name: PowershellUniversal
  image: ironmansoftware/universal:3.7.14-ubuntu-20.04
  restart: unless-stopped
  volumes:
    - /Users/stevenspierenburg/Temp/docker/volumes/psu:/root
  ports:
    - "6002:5000"

(not sure about the 3 dashes on top of the yaml file but I took them as they are present in the example you gave)

Everytime I try to use ‘compose’ I get this:

docker compose up -d
services.volumes must be a mapping

docker compose up -d
services.ports must be a mapping

docker % docker compose up -d
services.restart must be a mapping

docker compose up -d
services.PowershellUniversal must be a mapping

Every time I run the compose command I get another output, it seems to cycle between all the ‘issues’ it finds?

Hi Adam,

Let me know if you need something from my end to test or try.

Apologies @adam, I did not see your message before I posted “That all seams to be working”.

@Steven,

the dashes at the top are needed.

Everything below the line PowershellUniversal: needs to be indented out. the same error happened on my device until i spotted that.

2023-03-06 18_46_27-Window

Once i changed that my container started.

Let me know how that goes

Hi Matt,

Did the indent and that helped getting compose running:

docker compose up -d
[+] Running 2/0
⠿ Network docker_default Created 0.0s
[+] Running 1/3wershellUniversal ⠿ Network docker_default Created 0.0sux/amd64) does not match the detected host platform (linux/arm[+] Running 1/3wershellUniversal ⠿ Network docker_default Created 0.0sux/amd64) does not match the detected host platform (linux/arm[+] Running 2/3wershellUniversal ⠿ Network docker_default Created 0.0sux/amd64) does not match the detected host platform (linux/arm ⠿ Container PowershellUniversal Started 0.3s
⠸ PowershellUniversal The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s

When navigating to http://localhost:6002 I see no responses:

This page isn’t working
localhost didn’t send any data.
ERR_EMPTY_RESPONSE

Looking at Docker Desktop and the log of the container running:

023-03-06 21:53:05 PowershellUniversal | [20:53:05 FTL] Fatal error starting PowerShell Universal.
2023-03-06 21:53:05 PowershellUniversal | System.IO.IOException: Function not implemented
2023-03-06 21:53:05 PowershellUniversal | at System.IO.FileSystemWatcher.StartRaisingEvents()
2023-03-06 21:53:05 PowershellUniversal | at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
2023-03-06 21:53:05 PowershellUniversal | at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func1 changeTokenProducer, Action changeTokenConsumer) 2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source) 2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder) 2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() 2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration() 2023-03-06 21:53:05 PowershellUniversal | at Microsoft.Extensions.Hosting.HostBuilder.Build() 2023-03-06 21:53:05 PowershellUniversal | at Universal.Server.Program.<>c__DisplayClass3_0.<Main>b__0(Options o) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Program.cs:line 72 2023-03-06 21:53:06 PowershellUniversal | Unhandled exception. System.IO.IOException: Function not implemented 2023-03-06 21:53:06 PowershellUniversal | at System.IO.FileSystemWatcher.StartRaisingEvents() 2023-03-06 21:53:06 PowershellUniversal | at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed() 2023-03-06 21:53:06 PowershellUniversal | at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value) 2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher() 2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter) 2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter) 2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0() 2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func1 changeTokenProducer, Action changeTokenConsumer)
2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.Configuration.FileConfigurationProvider…ctor(FileConfigurationSource source)
2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
2023-03-06 21:53:06 PowershellUniversal | at Microsoft.Extensions.Hosting.HostBuilder.Build()
2023-03-06 21:53:06 PowershellUniversal | at Universal.Server.Program.<>c__DisplayClass3_0.b__0(Options o) in C:\actions-runner_work\universal\universal\src\Universal.Server\Program.cs:line 72
2023-03-06 21:53:06 PowershellUniversal | at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action1 action)
2023-03-06 21:53:06 PowershellUniversal | at Universal.Server.Program.Main(String args) in C:\actions-runner_work\universal\universal\src\Universal.Server\Program.cs:line 52
2023-03-06 21:53:06 PowershellUniversal | qemu: uncaught target signal 6 (Aborted) - core dumped

Hey @Steven

Are you running a mac with an m1 chip?

thanks

Hi Chris,

Yes I am. Heres all the info relevant. If you need more I’m happy to oblige.

Try this: Install Docker Desktop on Mac

After installing… I was able to run PSU container.

softwareupdate --install-rosetta

Hi Chris,

Thanks for the help.

I installed the M1 / Mac with Apple silicon before, I started out with that version/type.

I did run the command you suggested:

softwareupdate --install-rosetta

I still get the error in the logs after starting either my own or the one from the repository.

Fatal error starting PowerShell Universal.
2023-03-06 23:07:50 System.IO.IOException: Function not implemented

Maybe I need to uninstall and re-install everything?

You can try. Did Rosetta get install successfully. Rebuild and run the container?

Hi Chris,

I did just now re-build the Container
First I removed all Images and Containers I had and closed Docker Desktop.
Then ran:

docker system prune

Then ran Rosetta isnatall again:

softwareupdate --install-rosetta

Outcome was:

softwareupdate[2666:22215] Package Authoring Error: 032-48321: Package reference >com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute

Install of Rosetta 2 finished successfully

Started the Image wich resulted in a Container and the log of that container said:
Fatal error starting PowerShell Universal.

2023-03-07 08:29:28 System.IO.IOException: Function not implemented
2023-03-07 08:29:28 at System.IO.FileSystemWatcher.StartRaisingEvents()
2023-03-07 08:29:28 at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()

I’m sorry for all the problems, this is not easy it seems. Not sure what I am doing wrong…

@Steven,

Can you try to install colima and try to start the container again?

brew install colima
colima start

abiosoft/colima: Container runtimes on macOS (and Linux) with minimal setup (github.com)