[lxc-users] Start container from systemd

Serge Hallyn serge.hallyn at ubuntu.com
Sun Mar 1 23:59:36 UTC 2015


Quoting Mark Clarkson (mark.clarkson at smorg.co.uk):
> 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
> |---------------------------------------

Hi,

Is there a reason you're not using autostart for this?  Does that
fail also?

I'm not claiming to know whether autostart is properly hooked in right
now when you're running systemd :)  But if it's not we should fix that.

> '/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
> 
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list