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-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-05-25 17:23:46 +07:00
- Multi-platform
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-05-16 02:58:33 +07:00
```yaml
2023-04-04 00:33:53 +07:00
environment:
2023-05-16 03:26:56 +07:00
DISK_SIZE: "256G"
2023-04-04 00:09:17 +07:00
```
2023-07-03 16:59:40 +07:00
This can also be used to resize the existing disk to a larger capacity without data loss.
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-05-18 23:48:39 +07:00
To change the virtual disk's location from the default Docker volume, include the following bind mount in your compose file:
2023-04-04 00:09:17 +07:00
2023-05-16 02:58:33 +07:00
```yaml
2023-04-04 00:09:17 +07:00
volumes:
2023-05-16 03:26:56 +07:00
- /home/user/data:/storage
2023-04-04 00:09:17 +07:00
```
2023-05-07 01:40:26 +07:00
Replace the example path `/home/user/data` with the desired storage folder.
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-18 23:48:39 +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
2023-05-16 02:58:33 +07:00
```yaml
2023-04-19 22:29:22 +07:00
environment:
2023-05-16 03:26:56 +07:00
ALLOCATE: "N"
2023-04-19 22:29:22 +07:00
```
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-05-18 23:48:39 +07:00
* ### How do I increase the amount of CPU or RAM?
2023-04-19 03:09:05 +07:00
2023-05-18 23:48:39 +07:00
By default, a single core and 512 MB of RAM are allocated to the container. To increase this, add the following environment variables:
2023-04-19 03:09:05 +07:00
2023-05-16 02:58:33 +07:00
```yaml
2023-04-19 03:09:05 +07:00
environment:
2023-05-16 03:26:56 +07:00
CPU_CORES: "4"
RAM_SIZE: "2048M"
2023-04-19 03:09:05 +07:00
```
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
2023-05-16 02:58:33 +07:00
```bash
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-05-18 23:48:39 +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
2023-05-16 02:58:33 +07:00
```bash
2023-05-13 13:22:44 +07:00
docker network create -d macvlan \
2023-04-08 20:55:16 +07:00
--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-05-13 13:22:44 +07:00
Be sure to modify these values to match your local subnet.
2023-04-20 03:49:45 +07:00
2023-05-18 23:48:39 +07:00
Once you have created the network, change your compose file to look as follows:
2023-04-08 20:55:16 +07:00
2023-05-16 02:58:33 +07:00
```yaml
2023-05-16 03:23:11 +07:00
services:
dsm:
2023-05-16 03:28:35 +07:00
container_name: dsm
2023-05-16 03:23:11 +07:00
..< snip > ..
networks:
vdsm:
ipv4_address: 192.168.0.100
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
2023-05-18 23:48:39 +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-05-13 13:53:37 +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, you need to create a [second macvlan ](https://blog.oddbit.com/post/2018-03-12-using-docker-macvlan-networks/#host-access ) as a workaround.
2023-04-20 21:51:30 +07:00
2023-05-07 02:02:50 +07:00
* ### How can the container acquire an IP address from my router?
2023-04-20 23:16:18 +07:00
2023-05-13 13:22:44 +07:00
After configuring the container for macvlan (see above), it is possible for DSM to become part of your home network by requesting an IP from your router, just like your other devices.
2023-05-07 17:34:04 +07:00
2023-05-13 13:22:44 +07:00
To enable this feature, add the following lines to your compose file:
2023-04-20 21:51:30 +07:00
2023-05-16 02:58:33 +07:00
```yaml
2023-04-20 21:51:30 +07:00
environment:
DHCP: "Y"
devices:
- /dev/vhost-net
device_cgroup_rules:
2023-05-26 03:05:33 +07:00
- 'c *:* rwm'
2023-04-20 21:51:30 +07:00
```
2023-05-26 04:10:15 +07:00
Please note that even if you don't need DHCP, it's still recommended to enable this feature as it prevents NAT issues and increases performance by using a `macvtap` interface.
2023-05-26 04:08:20 +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-05-18 23:48:39 +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-05-16 02:58:33 +07:00
```yaml
2023-04-04 00:33:53 +07:00
environment:
2023-05-26 03:09:21 +07:00
URL: "https://global.synologydownload.com/download/DSM/release/7.0.1/42218/DSM_VirtualDSM_42218.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
2023-05-18 23:48:39 +07:00
* ### What are the differences compared to the standard DSM?
2023-04-03 23:36:05 +07:00
2023-05-18 23:48:39 +07:00
There are only two minor differences: the Virtual Machine Manager package is not provided, and Surveillance Station doesn't include any free licenses.
2023-05-17 12:30:55 +07:00
2023-05-21 04:05:12 +07:00
* ### Is this project legal?
2023-05-17 12:30:55 +07:00
2023-05-21 04:07:14 +07:00
Yes, this project contains only open-source code and does not distribute any copyrighted material. Neither does it try to circumvent any copyright protection measures. So under all applicable laws, this project would be considered legal.
2023-05-17 12:30:55 +07:00
2023-05-18 23:48:39 +07:00
However, by installing Synology's Virtual DSM, you must accept their end-user license agreement, which does not permit installation on non-Synology hardware. So only run this project on an official Synology NAS via the Container Manager package, as any other use will be a violation of their terms and conditions.
2023-04-03 23:36:05 +07:00
2023-04-07 23:23:01 +07:00
## Disclaimer
2023-05-18 23:48:39 +07:00
Only run this container on Synology hardware, any other use is not permitted by their EULA. The product names, logos, brands, and other trademarks referred to within this project are the property of their respective trademark holders. This project is not affiliated, sponsored, or endorsed by Synology, Inc.
2023-05-12 19:35:56 +07:00
[build_url]: https://github.com/kroese/virtual-dsm/
[hub_url]: https://hub.docker.com/r/kroese/virtual-dsm
[tag_url]: https://hub.docker.com/r/kroese/virtual-dsm/tags
[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
[Pulls]: https://img.shields.io/docker/pulls/kroese/virtual-dsm.svg?style=flat& label=pulls& logo=docker
[Version]: https://img.shields.io/docker/v/kroese/virtual-dsm?arch=amd64& sort=date& color=066da5