Iām not sure what you call external terminal. Your first comand uses the apk package manager. I assume you raun it in a container. The second just runs a new container from an image which possibly gives you the temrinal in which you can run the previous command. So both are the same.
If you want to do it properly, create a Dockerfile, build your own image, push it to a registry or just use it locally and run the container from that image, so you donāt have to install anything interactively in a container. It is not just that you donāt have to, it is something thaty ou always have to avoid.
To learn about creating Docke rimages, I can recommend some links
Recommended links to learn the basics and concepts:
and then in the terminal i got line and lines and like this ā¦
ALSA lib confmisc.c:855:(parse_card) cannot find card ā0ā
ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM sysdefault
ALSA lib confmisc.c:855:(parse_card) cannot find card ā0ā
What you need to understand, as a beginner, is that you donāt install software into a container. A container is not a virtual machine, Do not treat it like one. You install software into an Image, and then create the container from that image. This is because when the container exits, all the software you installed is gone because containers are ephemeral. This is why you want to learn how to use a Dockerfile to create an image and then create a container from that image with all of the software already installed.
Here is an example of a Dockerfile that you might use given what you told us you are trying to do:
FROM alpine:latest
RUN apk add espeak
You can build the image with this command:
docker build -t espeak .
You can then run a shell in a container created from this image with:
docker run --rm -it --name espeak --privileged=true --device=/dev/snd:/dev/snd espeak sh
Notice that I added --privileged=true to allow the container to access the host machine and --device=/dev/snd:/dev/snd to bind the sound device of the host computer to the container because you are using espeak which requires a sound card.
Unfortunately, this still gives the same error that you are encountering. Iāve followed several examples that Iāve found on the internet and none of them seem to work. One used ALSA but the speaker-test threw the same error that you are getting with espeak.
I did come across some solutions that used PulseAudio as a driver installed on your host computer, but I didnāt test them out. I would say that as a beginner, you are in way over your head. Trying to get sound to work from a Docker container is not trivial. But donāt give up. You will undoubtedly learn a lot about Docker along the way. I would search for ādocker audio deviceā and try a few things out. Good Luck.
Thanks for all that info, very helpful, for the time being I have stopped trying to use espeak.
I have found that I can use Alexa to announce using Node-RED & a Alexa node.
All of this is in my Docker desktop install and working well.