arv-v-dsm/readme.md

190 lines
5.7 KiB
Markdown
Raw Normal View History

2023-04-16 08:41:05 +07:00
<h1 align="center">Virtual DSM for Docker
2023-04-16 08:50:57 +07:00
<br />
2023-04-16 08:41:05 +07:00
<p align="center">
<img src="https://github.com/kroese/virtual-dsm/raw/master/.github/screen.jpg" title="Screenshot" style="max-width:100%;" width="432" />
</p>
<div align="center">
2019-03-14 12:25:01 +07:00
2023-03-28 23:54:04 +07:00
[![build_img]][build_url]
2023-03-28 23:52:01 +07:00
[![gh_last_release_svg]][dsm-docker-hub]
[![Docker Image Size]][dsm-docker-hub]
2023-03-27 02:21:13 +07:00
[![Docker Pulls Count]][dsm-docker-hub]
2023-03-28 23:54:04 +07:00
[build_url]: https://github.com/kroese/virtual-dsm/actions
2023-03-27 02:21:13 +07:00
[dsm-docker-hub]: https://hub.docker.com/r/kroese/virtual-dsm
2023-04-03 19:14:15 +07:00
[build_img]: https://github.com/kroese/virtual-dsm/actions/workflows/build.yml/badge.svg
2023-03-28 23:52:01 +07:00
[Docker Image Size]: https://img.shields.io/docker/image-size/kroese/virtual-dsm/latest
[Docker Pulls Count]: https://img.shields.io/docker/pulls/kroese/virtual-dsm.svg?style=flat
[gh_last_release_svg]: https://img.shields.io/docker/v/kroese/virtual-dsm?arch=amd64&sort=date
2019-03-18 04:44:21 +07:00
2023-04-16 08:41:05 +07:00
</div></h1>
2023-04-14 02:11:15 +07:00
Virtual DSM in a docker container.
2023-04-03 05:29:32 +07:00
## Features
2023-04-12 01:36:37 +07:00
- KVM acceleration
- Graceful shutdown
2023-04-14 23:17:12 +07:00
- Upgrades supported
2019-03-14 12:25:01 +07:00
2023-04-03 05:40:09 +07:00
## Usage
2019-03-14 12:25:01 +07:00
2023-04-12 02:56:47 +07:00
Via `docker-compose.yml`
2019-03-14 12:25:01 +07:00
```yaml
version: "3"
services:
2023-04-13 08:18:14 +07:00
dsm:
2023-03-30 08:22:36 +07:00
container_name: dsm
2023-03-27 01:37:18 +07:00
image: kroese/virtual-dsm:latest
2023-03-28 10:22:02 +07:00
environment:
DISK_SIZE: "16G"
2019-03-14 12:25:01 +07:00
devices:
- /dev/kvm
2023-04-04 02:26:18 +07:00
cap_add:
- NET_ADMIN
2023-03-27 01:37:18 +07:00
ports:
- 5000:5000
2023-03-28 10:14:21 +07:00
- 5001:5001
2023-03-29 00:30:42 +07:00
restart: on-failure
2023-04-13 21:09:51 +07:00
stop_grace_period: 1m
2019-03-14 12:25:01 +07:00
```
2023-04-03 05:38:53 +07:00
2023-04-12 02:56:47 +07:00
Via `docker run`
2023-04-03 05:38:53 +07:00
```bash
2023-04-19 03:09:05 +07:00
docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-timeout 60 kroese/virtual-dsm:latest
2023-04-03 05:38:53 +07:00
```
2023-04-03 22:48:49 +07:00
## FAQ
2023-04-19 03:09:05 +07:00
* ### How do I check if my system supports KVM?
To check if your system supports KVM run these commands:
```
sudo apt install cpu-checker
sudo kvm-ok
```
If `kvm-ok` returns an error stating KVM acceleration cannot be used, you may need to change your BIOS settings.
2023-04-04 00:09:17 +07:00
* ### How do I change the size of the virtual disk? ###
2023-04-03 22:48:49 +07:00
2023-04-19 22:42:12 +07:00
By default it is 16GB, but to increase it you can modify the `DISK_SIZE` setting in your compose file:
2023-04-03 22:48:49 +07:00
2023-04-04 00:09:17 +07:00
```
2023-04-04 00:33:53 +07:00
environment:
2023-04-12 01:37:55 +07:00
DISK_SIZE: "16G"
2023-04-04 00:09:17 +07:00
```
2023-04-03 22:48:49 +07:00
2023-04-15 23:02:51 +07:00
To resize the disk to a capacity of 8 terabyte you would use a value of `"8T"` for example.
2023-04-03 23:36:05 +07:00
2023-04-04 00:09:17 +07:00
* ### How do I change the location of the virtual disk? ###
2023-04-03 23:36:05 +07:00
2023-04-19 22:42:12 +07:00
By default it resides inside a docker volume, but to store it somewhere else you can add these lines to your compose file:
2023-04-04 00:09:17 +07:00
```
volumes:
2023-04-12 01:37:55 +07:00
- /home/user/data:/storage
2023-04-04 00:09:17 +07:00
```
2023-04-04 00:35:21 +07:00
Just replace `/home/user/data` with the path to the folder you want to use for storage.
2023-04-04 00:09:17 +07:00
2023-04-19 22:33:25 +07:00
* ### How do I change the space reserved by the virtual disk? ###
2023-04-19 22:29:22 +07:00
2023-04-19 22:42:12 +07:00
By default the total space for the disk is reserved in advance. If you want to only reserve the space that is actually used by the disk, add these lines:
2023-04-19 22:29:22 +07:00
```
environment:
ALLOCATE: "N"
```
2023-04-19 22:33:25 +07:00
This might lower performance a bit, since the image file will need to grow every time new data is added to it.
2023-04-19 22:29:22 +07:00
2023-04-19 03:09:05 +07:00
* ### How do I change the amount of CPU/RAM? ###
2023-04-19 22:45:06 +07:00
By default a single core and 512MB of RAM is allocated to the container.
2023-04-19 03:09:05 +07:00
To increase this you can add the following environment variabeles:
```
environment:
CPU_CORES: "4"
RAM_SIZE: "2048M"
```
2023-04-19 22:39:59 +07:00
* ### How do I give the container its own IP address?
2023-04-08 20:55:16 +07:00
2023-04-19 22:39:59 +07:00
By default the container uses bridge networking, and uses the same IP as the docker host.
2023-04-08 20:55:16 +07:00
2023-04-19 22:48:28 +07:00
If you want to give it a seperate IP address, create a macvlan network. For example:
2023-04-08 20:55:16 +07:00
```
$ docker network create -d macvlan \
--subnet=192.168.0.0/24 \
--gateway=192.168.0.1 \
--ip-range=192.168.0.100/28 \
2023-04-19 22:39:59 +07:00
-o parent=eth0 vdsm
2023-04-08 20:55:16 +07:00
```
2023-04-20 03:49:45 +07:00
Modify these values to match your local subnet.
2023-04-20 11:48:16 +07:00
Now change the containers configuration in your compose file:
2023-04-08 20:55:16 +07:00
```
2023-04-20 03:47:27 +07:00
networks:
vdsm:
ipv4_address: 192.168.0.100
```
2023-04-20 03:51:24 +07:00
And add the network to the very bottom of your compose file:
2023-04-20 03:47:27 +07:00
```
networks:
2023-04-20 03:49:45 +07:00
vdsm:
2023-04-20 03:47:27 +07:00
external: true
2023-04-08 20:55:16 +07:00
```
2023-04-19 22:48:28 +07:00
This also has the advantage that you don't need to do any portmapping anymore, because all ports will be fully exposed this way.
2023-04-20 21:51:30 +07:00
* ### How can the container retrieve an IP via DHCP? ###
First follow the steps to configure the container for macvlan (see above), and then add the following lines to your compose file:
```
environment:
DHCP: "Y"
devices:
- /dev/vhost-net
device_cgroup_rules:
- 'c 510:* rwm'
```
This will make DSM retrieve an IP from your router. This will not be the same as the macvlan IP of the container, so to determine which one was assigned to DSM please check the container logfile or use the devices page of your router for example.
NOTE: The exact cgroup rule may be different than `510` depending on your system, but the correct rule number will be printed to the logfile in case of error.
2023-04-04 00:09:17 +07:00
* ### How do I install a specific version of vDSM? ###
2023-04-04 03:24:39 +07:00
By default it installs vDSM 7.2, but if you want to use an older version you can add its URL to your compose file:
2023-04-04 00:09:17 +07:00
```
2023-04-04 00:33:53 +07:00
environment:
2023-04-16 00:08:16 +07:00
URL: "https://global.synologydownload.com/download/DSM/release/7.1.1/42962-1/DSM_VirtualDSM_42962.pat"
2023-04-04 00:09:17 +07:00
```
2023-04-03 23:36:05 +07:00
2023-04-04 00:09:17 +07:00
You can also switch back and forth between versions this way without loosing your file data.
2023-04-03 23:36:05 +07:00
2023-04-04 00:09:17 +07:00
* ### What are the differences compared to standard DSM? ###
2023-04-03 23:36:05 +07:00
2023-04-08 07:44:36 +07:00
There are only three minor differences: the Virtual Machine Manager package is not available, Surveillance Station does not include any free licenses, and logging in to your Synology account is not supported.
2023-04-03 23:36:05 +07:00
2023-04-04 23:05:47 +07:00
## Acknowledgments
2023-04-07 00:12:53 +07:00
Based on an [article](https://jxcn.org/2022/04/vdsm-first-try/) by JXCN.
2023-04-07 23:23:01 +07:00
## Disclaimer
2023-04-07 23:31:58 +07:00
Only run this container on original Synology hardware, any other use is not permitted and might not be legal.