Method for automatically starting the LXD container when starting Linux

Q: I am using a virtual machine based on LXD ("Linux Container"). How do I automatically launch the LXD container when I start it on a Linux system?

When LXD runs at startup, you can start the container at any time. You need to set boot.autostart to true. You can use the boot.autostart.priority (default is 0) option to define the order in which the containers are started (starting from the highest). You can also use the boot.autostart.delay (default 0) option to define another container to start after waiting a few seconds after starting a container.

grammar

The keywords discussed above can be set using the lxc tool with the following syntax:

$ lxc config set{vm-name}{key}{value}

$ lxc config set{vm-name} boot.autostart {true|false}

$ lxc config set{vm-name} boot.autostart.priority integer

$ lxc config set{vm-name} boot.autostart.delay integer

How do I get the LXD container to start at startup in Ubuntu Linux 16.10?

Enter the following command:

$ lxc config set{vm-name} boot.autostart true

Set an LXD container name "nginx-vm" to start at startup

$ lxc config set nginx-vm boot.autostart true

You can verify the settings with the following syntax:

$ lxc config get{vm-name} boot.autostart

$ lxc config get nginx-vm boot.autostart

Sample output:

True

You can use the following syntax to start another container after waiting 10 seconds after starting the container:

$ lxc config set nginx-vm boot.autostart.delay 10

Finally, define the order in which the containers are started by setting the highest value. Make sure the dbvm container is started first, then start nginxvm.

$ lxc config set db_vm boot.autostart.priority 100

$ lxc config set nginx_vm boot.autostart.priority 99

View all [1] configuration values ​​on Linux using the bash loop below:

#!/bin/bash

Echo'The current values ​​of each vm boot parameters:'

For c in db_vm nginx_vm memcache_vm

Do

Echo"*** VM: $c ***"

For v in boot.autostart boot.autostart.priority boot.autostart.delay

Do

Echo"Key: $v => $(lxc config get $c $v) "

Done

Echo""

Done

Sample output:

Fig.01: Get autostarting LXD containers values ​​using a bash shell script

Camera Cable

Connects PC or laptop with the projector, LCD monitor, and other video display system through VGA connections
Fully shielded VGA / SVGA extension or replacement cable
Supports resolutions at 800x600 (SVGA), 1024x768 (XGA), 1600x1200 (UXGA), 1080p (Full HD), 1920x1200 (WUXGA), and up for high resolution LCD and LED monitors
Gold-plated connectors; 100% bare copper conductors
Each SVGA Cable have two high density HD15 connectors with thumbscrews

Camera Cable,Camera Usb Cable,Usb Camera Adapter,Camera Link Cable

UCOAX , https://www.jsucoax.com