├── .github └── workflows │ └── docker-publish.yml ├── Dockerfile ├── LICENSE ├── README.md └── supervisord.conf /.github/workflows/docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: Docker 2 | 3 | on: 4 | # Auto update every week 5 | schedule: 6 | - cron: "30 2 * * 1" 7 | 8 | push: 9 | # Publish `main` as Docker `latest` image. 10 | branches: 11 | - main 12 | 13 | # Publish `v1.2.3` tags as releases. 14 | tags: 15 | - v* 16 | 17 | # Run tests for any PRs. 18 | pull_request: 19 | 20 | env: 21 | IMAGE_NAME: libvirtd 22 | 23 | jobs: 24 | # Run tests. 25 | # See also https://docs.docker.com/docker-hub/builds/automated-testing/ 26 | test: 27 | runs-on: ubuntu-latest 28 | 29 | steps: 30 | - uses: actions/checkout@v2 31 | 32 | - name: Run tests 33 | run: | 34 | if [ -f docker-compose.test.yml ]; then 35 | docker-compose --file docker-compose.test.yml build 36 | docker-compose --file docker-compose.test.yml run sut 37 | else 38 | docker build . --file Dockerfile 39 | fi 40 | 41 | # Push image to GitHub Packages. 42 | # See also https://docs.docker.com/docker-hub/builds/ 43 | push: 44 | # Ensure test job passes before pushing image. 45 | needs: test 46 | 47 | runs-on: ubuntu-latest 48 | if: github.event_name == 'push' 49 | 50 | permissions: 51 | contents: read 52 | packages: write 53 | 54 | steps: 55 | - uses: actions/checkout@v2 56 | 57 | - name: Build image 58 | run: docker build . --file Dockerfile --tag $IMAGE_NAME 59 | 60 | - name: Log into registry 61 | run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin 62 | 63 | - name: Push image 64 | run: | 65 | IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME 66 | 67 | # Change all uppercase to lowercase 68 | IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') 69 | 70 | # Strip git ref prefix from version 71 | VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') 72 | 73 | # Strip "v" prefix from tag name 74 | [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') 75 | 76 | # Use Docker `latest` tag convention 77 | [ "$VERSION" == "master" ] && VERSION=latest 78 | 79 | echo IMAGE_ID=$IMAGE_ID 80 | echo VERSION=$VERSION 81 | 82 | docker tag $IMAGE_NAME $IMAGE_ID:$VERSION 83 | docker push $IMAGE_ID:$VERSION 84 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | RUN apk add --no-cache \ 4 | supervisor \ 5 | ovmf \ 6 | seabios \ 7 | libvirt-client \ 8 | libvirt-daemon \ 9 | libvirt-common-drivers \ 10 | libvirt-qemu \ 11 | qemu-system-x86_64 \ 12 | qemu-audio-alsa \ 13 | qemu-audio-oss \ 14 | qemu-audio-pa \ 15 | qemu-audio-sdl \ 16 | qemu-audio-spice \ 17 | qemu-block-curl \ 18 | qemu-block-dmg-bz2 \ 19 | qemu-block-nfs \ 20 | qemu-block-ssh \ 21 | qemu-chardev-spice \ 22 | qemu-hw-display-qxl \ 23 | qemu-hw-display-virtio-gpu \ 24 | qemu-hw-display-virtio-gpu-pci \ 25 | qemu-hw-display-virtio-vga \ 26 | qemu-hw-usb-redirect \ 27 | qemu-img \ 28 | && addgroup -S mumble-server && adduser -S mumble-server -G mumble-server 29 | 30 | COPY supervisord.conf /etc/supervisord.conf 31 | 32 | VOLUME ["/var/run/libvirt/", "/var/lib/libvirt"] 33 | 34 | CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Vincent Rouillé 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-libvirtd 2 | 3 | Alpine Linux libvirt (qemu+kvm) docker image 4 | 5 | GitHub action is setup so this image is __updated every week__. 6 | 7 | _docker run_: 8 | 9 | ```sh 10 | mkdir run 11 | mkdir var 12 | docker run --privileged \ 13 | -v $(pwd)/run:/var/run/libvirt \ 14 | -v $(pwd)/var:/var/lib/libvirt \ 15 | ghcr.io/speedy37/docker-libvirtd/libvirtd:main 16 | ``` 17 | 18 | _libvirtd clients_ examples: 19 | 20 | ```sh 21 | virsh -c qemu:///system?socket=$(pwd)/run/libvirt-sock 22 | ``` 23 | 24 | ```sh 25 | virt-manager -c qemu:///system?socket=$(pwd)/run/libvirt-sock 26 | ``` -------------------------------------------------------------------------------- /supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | user=root 4 | 5 | [program:libvirtd] 6 | command=/usr/sbin/libvirtd 7 | 8 | [program:virtlockd] 9 | command=/usr/sbin/virtlockd 10 | 11 | [program:virtlogd] 12 | command=/usr/sbin/virtlogd --------------------------------------------------------------------------------