├── Dockerfile ├── docker-entrypoint.sh └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7.4.1708 2 | 3 | LABEL maintainer="Vladislav Odintsov " 4 | 5 | RUN yum install -y \ 6 | epel-release 7 | 8 | RUN yum install -y \ 9 | git \ 10 | python-pip \ 11 | libvirt-python \ 12 | numpy \ 13 | python-websockify 14 | 15 | RUN mkdir /data/ 16 | 17 | RUN git clone https://github.com/retspen/webvirtmgr.git && \ 18 | cd webvirtmgr && \ 19 | git reset --hard v4.8.9 && \ 20 | pip install -r requirements.txt && \ 21 | ./manage.py collectstatic --noinput && \ 22 | ln -s /data/webvirtmgr.sqlite3 /webvirtmgr/ 23 | 24 | ADD docker-entrypoint.sh / 25 | 26 | ENTRYPOINT ["/docker-entrypoint.sh"] 27 | 28 | CMD [ "/webvirtmgr/manage.py", "run_gunicorn", "-c", "/webvirtmgr/conf/gunicorn.conf.py" ] 29 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | MANAGE_CMD="/webvirtmgr/manage.py" 4 | DB_FILE="/data/webvirtmgr.sqlite3" 5 | 6 | sed -i -e 's/127.0.0.1/0.0.0.0/g' /webvirtmgr/conf/gunicorn.conf.py 7 | 8 | if [ "$1" == "webvirtmgr-console" ]; then 9 | exec /webvirtmgr/console/webvirtmgr-console 10 | else 11 | if [ ! -f "$DB_FILE" ]; then 12 | [ -z $WEBVIRTMGR_ADMIN_USERNAME ] && echo "WEBVIRTMGR_ADMIN_USERNAME not supplied!" && exit 1 13 | [ -z $WEBVIRTMGR_ADMIN_EMAIL ] && echo "WEBVIRTMGR_ADMIN_EMAIL not supplied!" && exit 1 14 | [ -z $WEBVIRTMGR_ADMIN_PASSWORD ] && echo "WEBVIRTMGR_ADMIN_PASSWORD not supplied!" && exit 1 15 | 16 | $MANAGE_CMD syncdb --noinput || exit 1 17 | echo " 18 | from django.contrib.auth.models import User; 19 | User.objects.create_superuser('${WEBVIRTMGR_ADMIN_USERNAME}', '${WEBVIRTMGR_ADMIN_EMAIL}', '${WEBVIRTMGR_ADMIN_PASSWORD}')" | $MANAGE_CMD shell || exit 1 20 | echo "Superuser created successfully!" 21 | 22 | $MANAGE_CMD collectstatic --noinput || exit 1 23 | echo "webvirt preparations are done!" 24 | fi 25 | 26 | exec $@ 27 | fi -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DockerHub image link: https://hub.docker.com/r/odivlad/webvirtmgr/ 2 | 3 | This image is based on centos 7.4 official image. 4 | 5 | To run webvirtmgr you must specify admin user, admin email and admin password via environment variables `WEBVIRTMGR_ADMIN_USERNAME`, `WEBVIRTMGR_ADMIN_EMAIL` and `WEBVIRTMGR_ADMIN_PASSWORD`. You must do this only on first run to initialise database. 6 | 7 | This image exposes 8000/tcp port for main application and 6080/tcp port for VNC console app. You should setup access to these ports accordingly to cmdline. 8 | By default it executes main application. If you supply `webvirtmgr-console` as CMD, VNC proxy would be run. 9 | 10 | ### Main application 11 | 12 | First run: 13 | 14 | ``` 15 | docker run -d --name webvirtmgr -v /path/to/db/:/data/ -e WEBVIRTMGR_ADMIN_USERNAME=admin -e WEBVIRTMGR_ADMIN_EMAIL=admin@local.domain -e WEBVIRTMGR_ADMIN_PASSWORD=password -p 8000:8000 odivlad/webvirtmgr 16 | ``` 17 | 18 | All other runs: 19 | 20 | ``` 21 | docker run -d --name webvirtmgr -v /path/to/db/:/data/ -p 8000:8000 odivlad/webvirtmgr 22 | ``` 23 | 24 | ### VNC proxy 25 | 26 | If you need VNC console, run additional container like this: 27 | 28 | ``` 29 | docker run -d --name webvirtmgr-console -v /path/to/db/:/data/ -p 6080:6080 odivlad/webvirtmgr webvirtmgr-console 30 | ``` 31 | 32 | Application logs are available via `docker logs ` command. 33 | 34 | You are welcome to send patches and raise issues via github at https://github.com/odivlad/webvirtmgr-docker/ --------------------------------------------------------------------------------