I have created this service to start lxc container.
#
# ~/.config/systemd/user/container.service
#
[Unit]
Description=lxc-autostart containers
DefaultDependencies=no
Wants=network.target lxc.service
[Service]
Type=simple
RemainAfterExit=yes
Delegate=yes
ExecStart=lxc-start -n dns1
ExecStop=lxc-stop --kill dns1
[Install]
WantedBy=default.target
Works fine
lxc-ls -1f
dns1 RUNNING 0 - 192.168.0.4 - true
But if I close ssh session on server, the container stop and became unresponsive from other machines, let see the ping, you see destination unreachable when I close ssh session from host, why?
PING 192.168.0.4 (192.168.0.4) 56(84) bytes of data.
64 bytes from 192.168.0.4: icmp_seq=1 ttl=64 time=4.98 ms
64 bytes from 192.168.0.4: icmp_seq=2 ttl=64 time=4.26 ms
64 bytes from 192.168.0.4: icmp_seq=3 ttl=64 time=3.30 ms
From 192.168.0.2 icmp_seq=42 Destination Host Unreachable
From 192.168.0.2 icmp_seq=43 Destination Host Unreachable
From 192.168.0.2 icmp_seq=44 Destination Host Unreachable
From 192.168.0.2 icmp_seq=45 Destination Host Unreachable
From 192.168.0.2 icmp_seq=46 Destination Host Unreachable
From 192.168.0.2 icmp_seq=47 Destination Host Unreachable
64 bytes from 192.168.0.4: icmp_seq=48 ttl=64 time=1460 ms
64 bytes from 192.168.0.4: icmp_seq=49 ttl=64 time=436 ms
Distribution is Debian 13