I'd like to play a beep with the buzzer from a Docker image.
So far, I've been able to play a beep using the following command:
echo -e "\a" > /dev/console
This works correctly under Ubuntu 20.04.
I've tried to encapsulate this code into a Docker image:
FROM ubuntu:focal
RUN echo '#!/bin/bash' > /bootstrap.sh
RUN echo 'for i in {1..5}' >> /bootstrap.sh
RUN echo 'do' >> /bootstrap.sh
RUN echo ' echo "B"' >> /bootstrap.sh
RUN echo ' echo -e "\\a" > /dev/console' >> /bootstrap.sh
RUN echo ' sleep 0.5' >> /bootstrap.sh
RUN echo 'done' >> /bootstrap.sh
RUN echo 'sleep infinity' >> /bootstrap.sh
RUN chmod +x /bootstrap.sh
CMD /bootstrap.sh
To run the image, I've used the following command:
docker run -t -i --privileged -v /dev/console:/dev/console bell
This does not produce any sound. I've also tried to start a shell into the image but the commands only returns an empty string.
Any idea on how to fix this ?