arv-v-dsm/readme.md

182 lines
5.6 KiB
Markdown
Raw Normal View History

2023-05-02 03:11:12 +07:00
<h1 align="center">Virtual DSM for Docker<br />
2023-05-02 03:05:54 +07:00
<div align="center">
2023-04-16 08:41:05 +07:00
<img src="https://github.com/kroese/virtual-dsm/raw/master/.github/screen.jpg" title="Screenshot" style="max-width:100%;" width="432" />
2023-05-02 03:05:54 +07:00
</div>
2023-04-16 08:41:05 +07:00
<div align="center">
2019-03-14 12:25:01 +07:00
2023-05-02 02:56:33 +07:00
[![Build]][build_url]
2023-05-06 20:24:34 +07:00
[![Version]][tag_url]
[![Size]][tag_url]
2023-05-02 02:56:33 +07:00
[![Pulls]][hub_url]
2023-03-27 02:21:13 +07:00
2023-04-30 03:40:36 +07:00
[build_url]: https://github.com/kroese/virtual-dsm/
2023-05-02 02:56:33 +07:00
[hub_url]: https://hub.docker.com/r/kroese/virtual-dsm
2023-05-06 20:24:34 +07:00
[tag_url]: https://hub.docker.com/r/kroese/virtual-dsm/tags
2023-04-03 19:14:15 +07:00
2023-05-02 02:56:33 +07:00
[Build]: https://github.com/kroese/virtual-dsm/actions/workflows/build.yml/badge.svg
[Size]: https://img.shields.io/docker/image-size/kroese/virtual-dsm/latest?color=066da5&label=size
2023-05-02 15:45:40 +07:00
[Pulls]: https://img.shields.io/docker/pulls/kroese/virtual-dsm.svg?style=flat&label=pulls&logo=docker
2023-05-02 02:56:33 +07:00
[Version]: https://img.shields.io/docker/v/kroese/virtual-dsm?arch=amd64&sort=date&color=066da5
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-05-06 20:08:03 +07:00
- /dev/vhost-net
2023-04-04 02:26:18 +07:00
cap_add:
- NET_ADMIN
2023-03-27 01:37:18 +07:00
ports:
- 5000:5000
2023-04-24 02:22:39 +07:00
volumes:
- /opt/dsm:/storage
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-23 08:07:25 +07:00
* ### How do I change the size of the virtual disk?
2023-04-03 22:48:49 +07:00
2023-04-23 08:07:25 +07:00
To expand the default size of 16 GB, locate the `DISK_SIZE` setting in your compose file and modify it to your preferred capacity:
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-05-07 00:56:38 +07:00
DISK_SIZE: "256G"
2023-04-04 00:09:17 +07:00
```
2023-04-03 22:48:49 +07:00
2023-04-23 08:07:25 +07:00
* ### How do I change the location of the virtual disk?
2023-04-03 23:36:05 +07:00
2023-04-23 08:07:25 +07:00
To change the virtual disk's location from the default docker volume, include the following bind mount in your compose file and replace the path `/home/user/data` with the desired storage folder:
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-23 08:09:14 +07:00
* ### How do I change the space reserved by the virtual disk?
2023-04-19 22:29:22 +07:00
2023-05-07 01:34:14 +07:00
By default, the entire disk space is reserved in advance. To create a growable disk, that only reserves the space that is actually used, add the following environment variable:
2023-04-19 22:29:22 +07:00
```
environment:
ALLOCATE: "N"
```
2023-05-07 01:17:34 +07:00
Keep in mind that this will not affect any of your existing disks, it only applies to newly created disks.
2023-04-19 22:29:22 +07:00
2023-04-23 22:53:34 +07:00
* ### How do I increase the amount of CPU/RAM?
2023-04-19 03:09:05 +07:00
2023-04-23 08:07:25 +07:00
By default, a single core and 512MB of RAM is allocated to the container. To increase this, add the following environment variables:
2023-04-19 03:09:05 +07:00
```
environment:
CPU_CORES: "4"
RAM_SIZE: "2048M"
```
2023-04-23 22:53:34 +07:00
* ### How do I verify if my system supports KVM?
2023-04-22 23:11:39 +07:00
2023-04-23 08:07:25 +07:00
To verify if your system supports KVM, run the following commands:
2023-04-22 23:11:39 +07:00
```
sudo apt install cpu-checker
sudo kvm-ok
```
2023-04-23 08:07:25 +07:00
If you receive an error from `kvm-ok` indicating that KVM acceleration can't be used, check your BIOS settings.
2023-04-08 20:55:16 +07:00
2023-04-23 08:18:51 +07:00
* ### How do I assign an individual IP address to the container?
2023-04-08 20:55:16 +07:00
2023-04-23 08:54:34 +07:00
By default, the container uses bridge networking which shares the IP address with the host.
2023-04-20 22:21:08 +07:00
2023-04-23 08:54:34 +07:00
If you want to assign an individual IP address to the container, you can create a macvlan network as follows:
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-23 08:18:51 +07:00
2023-04-23 08:07:25 +07:00
Be sure to modify the values to match your local subnet.
2023-04-20 03:49:45 +07:00
2023-04-23 08:07:25 +07:00
Once you have created the network, modify the container's configuration in your compose file as follows:
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-23 08:07:25 +07:00
Finally, add the network to the 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-23 08:07:25 +07:00
An added benefit of this approach is that you won't have to perform any port mapping anymore, since all ports will be exposed by default.
2023-04-08 20:55:16 +07:00
2023-04-23 08:54:34 +07:00
Please note that this IP address won't be accessible from the Docker host due to the design of macvlan, which doesn't permit communication between the two. If this is a concern, there are some workarounds available, but they go beyond the scope of this FAQ.
2023-04-20 21:51:30 +07:00
2023-04-23 08:07:25 +07:00
* ### How can the container acquire an IP address via DHCP?
2023-04-20 23:16:18 +07:00
2023-04-23 08:54:34 +07:00
After configuring the container for macvlan (see above), add the following lines to your compose file:
2023-04-20 21:51:30 +07:00
```
environment:
DHCP: "Y"
devices:
- /dev/vhost-net
device_cgroup_rules:
- 'c 510:* rwm'
```
2023-04-23 08:18:51 +07:00
Please note that the exact `cgroup` rule number may vary depending on your system, but the log output will indicate the correct number in case of an error.
2023-04-20 21:51:30 +07:00
2023-04-23 08:07:25 +07:00
* ### How do I install a specific version of vDSM?
2023-04-04 00:09:17 +07:00
2023-04-23 08:54:34 +07:00
By default version 7.2 will be installed, but if you prefer an older version, you can add its URL to your compose file as follows:
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-23 08:54:34 +07:00
With this method, you are able to switch between different versions while keeping your file data.
2023-04-23 08:07:25 +07:00
* ### What are the differences compared to standard DSM?
2023-04-03 23:36:05 +07:00
2023-04-23 08:07:25 +07:00
There are only three minor differences: the Virtual Machine Manager package is not provided, Surveillance Station doesn't include any free licenses, and logging in to your Synology account is not supported.
2023-04-03 23:36:05 +07:00
2023-04-07 23:23:01 +07:00
## Disclaimer
2023-04-26 17:56:24 +07:00
Only run this container on Synology hardware, any other use is not permitted and might not be legal.