Mycroft Community Forum

Mycroft and Docker images, a different approach

Hi community,

During the past few weeks I worked on building Docker images for Mycroft using a different approach, the micro-services one.

Basically each Mycroft services such as audio, skills, etc… will run into their own container with their own /shared volumes (when required).

The main differences with the official Mycroft images are:

  • Micro-service approach
  • No more skills “re-installation”
  • Automatic nightly build (dev only, until backports are applied to master) and pushed on Docker Hub
  • Multiple CPU architectures support
  • docker-compose support
  • GPIO support for Raspberry Pi
  • A container dedicated to the command line

It’s not perfect for sure but it fits my needs/requirements for the project I’m working on. Fill free to share your feedback and to contribute. :partying_face:

6 Likes

That looks awesome, looks like you’ve put a ton of work into it, and there are so many improvements on the current image.

1 Like

Amazing! Am going to play around with that immediately!

2 Likes

Yeah I had some fun evenings and I gained few more white hairs :rofl: I really enjoyed the learning of the buildx feature which allows the multi-arch support but overall I still be a Podman fan boy ^^

@mdverhoeven that would be great, I mostly tested the containers on ARM 64-bit so some surprises could happen! :crazy_face:

1 Like

Do you have any feedback to share, any bugs?
The PulseAudio part could be a bit tricky. :upside_down_face:

I applied XDG change from PR 2794. Images have been rebuild.

As far as I understood, the image assumes that there is a device that runs docker and requires audio and the microphone.
In my stack, we entirely rely on a Docker container in the cloud, i.e. there is no need for audio. Will this image work nicely in this setup too or is there even a configuration where I can exclude the audio?

Hi @ScienceGuy,

It depends I would say how you use Mycroft on the cloud but when creating the containers, it is not mandatory to pass the devices.

$ sudo docker run -d \
  -v ~/mycroft-config:/home/mycroft/.config/mycroft \
  -v ~/mycroft-web-cache:/var/tmp \
  -v mycroft_ipc:/tmp/mycroft/ipc \
  -v mycroft_skills:/opt/mycroft/skills \
  -v mycroft_skills_venv:/opt/mycroft-venv \
  -v mycroft_skills_repo:/opt/mycroft \
  -v ${XDG_RUNTIME_DIR}/pulse:${XDG_RUNTIME_DIR}/pulse \
  -v ~/.config/pulse/cookie:/home/mycroft/.config/pulse/cookie \
  -v /sys:/sys:ro \
  --device /dev/snd \
  --device /dev/gpiomem \ # For Raspberry Pi GPIO
  --group-add $(getent group audio | cut -d: -f3) \
  --group-add $(getent group gpio | cut -d: -f3) \ # For Raspberry Pi GPIO
  --env PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
  --env PULSE_COOKIE=/home/mycroft/.config/pulse/cookie \
  --network host \
  --name mycroft_skills \
  smartgic/mycroft-skills:dev

You could remove --device from the command and/or remove the pulseaudio part.

Hi,

i did some updates to the Docker images, please find the list below:

  • Implement precise-lite plugin from OpenVoiceOS, fooprint of mycroft_voice container reduced by 50% for CPU [1], memory [2] and fastest wakeword detection
  • Usage of tmpfs for /tmp/mycroft to reduce IO activity on the disk (mostly useful for Raspberry PI and it’s SD card), overall IOPS on the Raspberry Pi have been reduced by 50% [3]
  • Reduce the Docker volume usage to mycroft_skill* only
  • Use of environment files (.env*) with docker-compose to simplify the usage and the configuration of it
  • numpy Python library has been integrated to the mycroft_base image because it is now used by mycroft_voice and mycroft_skills containers. This speedup a lot the starting process after the pairing by not having to compile the library (especially on a Raspberry Pi… :scream:)
  • Documentation updates :paperclips:

[1] CPU usage for mycroft_voice container (6 hours sample):

[2] Memory usage for mycroft_voice container (6 hours sample):

[3] Disk IOPS usage for on the whole Raspberry Pi (24 hours sample):
image

Let me know if you got any issues. :heart_eyes:

2 Likes

3 posts were split to a new topic: Precise TFLite benchmarking

Hi,

i did some fixes to the Docker images but not only, please find the list below:

But the major update is the support of the Mycroft GUI, a new Docker image mycroft-gui had been added to Docker Hub and a new container mycroft_gui have been added to the docker-compose.yml file.

The GUI has been tested successfully on a Raspberry Pi 4B with OpenGL acceleration. On my desktop with a Nvidia GPU I had to change the QT_QUICK_BACKEND to software to have the GUI started (which means no OpenGL).

3 Likes