New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running docker in systemd-nspawn #220
Comments
Very strange.. Normally when it shuts down it should at least print an error message or the reason of shutting down. So its very hard to tell now whats happening. |
I now created a new release (v2.05) which should provide more error info in your case. Can you please try and see if it reports more info? And if not, can you try setting:
in your compose file, and see if outputs more info? |
Thanks for the effort, here are the results: docker-compose: version: "3"
services:
windows:
image: dockurr/windows
container_name: windows
devices:
- /dev/kvm
cap_add:
- NET_ADMIN
ports:
- 8006:8006
- 3389:3389/tcp
- 3389:3389/udp
stop_grace_period: 2m
restart: on-failure
environment:
MANUAL: "Y"
CONSOLE: "Y"
command: sleep infinity
Logs:
Weird, it doesn't even say now that is it shutting down. At the previous Version i could shortly see the same logs in the browser on port 8006. Now the container exits directly after "connecting to VNC" without the error messages. Does the /dev/kvm` device need some special permissions? On Truenas Host/Nspawn Container and Docker container the device got the following permissions: root@65350c78fe0e:/# ls -la /dev/kvm
crw-rw---- 1 root 104 10, 232 Mar 11 14:43 /dev/kvm
root@65350c78fe0e:/# Thank you! |
So it did some digging and found out that the the container also does need the device So what i did was running bind mounting The weird thing is when i enable the console for more debug like @kroese mentioned: environment:
CONSOLE: "Y" The VM would not start and only the following logs appeared when ❯ Starting Windows for Docker v2.05...
❯ For support visit https://github.com/dockur/windows
❯ Booting Windows using QEMU emulator version 8.2.1 ...
char device redirected to /dev/pts/0 (label serial0) ... and when i remove it, it works but the logs are kind of empty: No log line matching the '' filter I guess there is some kind of bug with that environment variable. |
@kiesstein Mmmh, very interesting find! In the past I had Also its weird that it does not complain about anything when its created, but just exits much later when QEMU is launched. And So I still dont completely understand what is going on in your case. But maybe I should just not create it automaticly, except in macvlan mode, so that in case it causes any problems it does not happen in bridge mode... Food for thought! |
You are right @kroese - it could not use |
Yes but the problem in this case is that But because In any case, I will make some changes and just disable |
I created a new tag (v2.06). Could you do me a favor and test if this version works in your original situation (where you did not mount /dev/vhost-net yet)? To see if the original issue is now solved. |
Ok so I tried to reproduce the problem with I tried to install Next test was instead Next was Next was Then I tested all bind mounts listed in this + --bind=/dev/kvm --capability=all --bind=/dev/vhost-net --bind=/dev/fuse --bind=/dev/vsock --bind=/dev/vhost-vsock
-> not working. Then I also tried to bind vhost-net in the dockerfile with devices:
- /dev/kvm
- /dev/vhost-net And still does not work. So I am not sure anymore what all I did in my testing but I can't get it running anymore with Then I tired with all the previous mentioned settings I am sorry that I tested wrong (changing more than one setting(winxp)). Then i did a
Then i tried In summary all the settings did nothing. Only thing i found out is that the it only works with |
Can you try v3.05 while adding the |
I was trying to start the container in a systemd-nspawn container where /dev/kvm is bind mounted inside.
Inside the jail i run kvm-ok:
The Jail is the docker host with the following config:
version: "3" services: windows: image: dockurr/windows container_name: windows devices: - /dev/kvm cap_add: - NET_ADMIN ports: - 8006:8006 - 3389:3389/tcp - 3389:3389/udp stop_grace_period: 2m restart: on-failure volumes: - /mnt/tank/all/kvm/win:/storage
But when i start the container the VM just shuts down:
How can i get more logs or what do i miss? Is it not possible to run with bind mounted /dev/kvm or nspawn-jail?
I also installed qemu-kvm inside the jail:
System: TrueNAS-Scale; Ryzen 1600x, SVM enabled
JailOS: Debian Bookworm
The text was updated successfully, but these errors were encountered: