[lxc-users] Start container from systemd

Mark Clarkson mark.clarkson at smorg.co.uk
Wed Feb 25 15:27:14 UTC 2015


Hi,
Does anyone know if it possible to start a container from systemd? 

I'm using an Ubuntu Vivid host. I added a systemd unit:

|----------------------------------------
 [Unit]
 Description=Linux Container %I
 After=network.target

 [Service]
 Type=simple
 Restart=always
 ExecStart=/usr/bin/lxc-start -F -n ubtr1
 ExecReload=/usr/bin/lxc-restart -F -n %i
 ExecStop=/usr/bin/lxc-stop -n %i

 [Install]
 WantedBy=multi-user.target
|---------------------------------------

'/usr/bin/lxc-start -F -n ubtr1' works fine from the console.

'systemctl start lxc at ubtr1' causes:

 lxc_start.c: main: 295 Executing '/sbin/init' with no configuration
file may crash the host

'lxc-start -F -n ubtr1 -l trace -o debug.out' when started from systemd:

      lxc-start 1424876366.120 INFO     lxc_start_ui -
lxc_start.c:main:264 - using rcfile /var/lib/lxc/ ubtr1/config
      lxc-start 1424876366.120 WARN     lxc_log - log.c:lxc_log_init:316
- lxc_log_init called with log already initialized
      lxc-start 1424876366.154 WARN     lxc_cgmanager -
cgmanager.c:cgm_get:962 - do_cgm_get exited with error
      lxc-start 1424876366.155 ERROR    lxc_start_ui -
lxc_start.c:main:295 - Executing '/sbin/init' with no configuration file
may crash the host

I have also tried disabling apparmor and relaxing directory permissions
but still no joy. Someone please help me!

Thanks!
Mark



More information about the lxc-users mailing list