Method for automatically starting the LXD container when starting Linux

Q: I'm using a virtual machine based on LXD ("Linux Container"). How can I automatically start the LXD container when the Linux system boots up? When LXD starts at boot time, you can configure containers to launch automatically. To do this, set `boot.autostart` to `true`. You can also use `boot.autostart.priority` (default is 0) to define the order in which containers are started — starting with the highest priority first. Additionally, `boot.autostart.delay` (default is 0) allows you to specify a delay in seconds before another container starts after the previous one. The configuration options mentioned above can be set using the `lxc` command-line tool with the following syntax: ``` $ lxc config set ``` For example: ``` $ lxc config set boot.autostart true $ lxc config set boot.autostart.priority $ lxc config set boot.autostart.delay ``` If you're using Ubuntu Linux 16.10 and want your LXD container to start automatically, run the following command: ``` $ lxc config set nginx-vm boot.autostart true ``` This will ensure that the container named "nginx-vm" starts automatically at boot. You can verify the setting using: ``` $ lxc config get nginx-vm boot.autostart ``` Sample output: ``` true ``` To add a delay of 10 seconds between the start of one container and another, use: ``` $ lxc config set nginx-vm boot.autostart.delay 10 ``` To control the startup order, set the `boot.autostart.priority` value. For instance, if you want `db_vm` to start before `nginx_vm`, you could set: ``` $ lxc config set db_vm boot.autostart.priority 100 $ lxc config set nginx_vm boot.autostart.priority 99 ``` You can view all the boot-related settings for multiple containers using a simple bash script like this: ```bash #!/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 ``` This script will list all the relevant boot configurations for each container. The output might look like the example shown in the image below. ![Fig.01: Get autostarting LXD containers values using a bash shell script](http://i.bosscdn.com/blog/1G/43/56/119-0.jpg) By customizing these settings, you can manage how your LXD containers start up and interact with each other during system boot.

M12 Distribution Box

M12 splitter can provide an easier connection of field components and clear wiring. In addition to the M12 thread full plastic dispenser, we also offer 7/8" dispensers. Main cable connection can be based on needs to choose ascrew connection or convenient direct connection. Use Y - type distributor to double the junction box socket. Thus, the wiring time and workload can be saved and the field signal distribution can be simplified.

M12 Distribution Box,M12 junction Box,M12 4 Way Distribution System,M12 junction box 8 way,M12 distribution box PNP NPN

Kunshan SVL Electric Co.,Ltd , https://www.svlelectric.com

Posted on