I have a named pipe that's been created in a Ubuntu Docker container (ubuntu-python). I'd like to send data into this pipe from the host operating system and read data from the pipe from the container.
Within Container:
I created the pipe within the container using
mkfifo stream
I then read from the stream using
cat stream
As expected, the command appears to hang because it's waiting for some input
Docker file
I then shared the named pipe to the host operating system using a volume
volumes:
- ./audio:/app/audio # stream is inside /app/audio
Host OS:
I ran
sudo bash -c "echo test > stream"
I expect this to write to the stream, this should cause the original cat stream command to unhang and print test, but both the input and the output commands continue to hang, showing that the data isn't actually being moved into the container. The reason I use bash -c is because I need the redirection to run as root.
This series of commands running on the host OS works perfectly, but once I introduce the volume and the movement of data between the host and the container, it no longer works. How can I write data to a named pipe from the host OS and have it show up in the container?
For reference, the host is WSL running Ubuntu 20.04, but I plan to deploy this on a Raspberry Pi 3B+ running Raspbian Lite. I also want to distribute this to other users of an open source project, so the solution should be host agnostic (atleast for hosts that can actually run a Ubuntu container).