How to disable auto start for all containers

Hi,

How to disable auto start for all containers as default

1 Like

Hi!

If this is a LXC question and not an LXD question (see https://blog.simos.info/comparison-between-lxc-and-lxd/), then you can set lxc.start.auto to 0. See more at https://linuxcontainers.org/lxc/manpages/man1/lxc-autostart.1.html

If instead you use LXD, you can get a list with all your containers with the following command.

lxc list --format=json | jq --raw-output '.[].name'

Then, for each container, you can run

lxc config set mycontainer boot.autostart false
2 Likes

so there is no default setting

You are asking how to change the default setting in LXD so that any newly created container does not autostart.

In that case, you set boot.autostart to false in your default profile.

$ lxc profile set default boot.autostart=false
$ lxc profile get default boot.autostart
false
$ lxc launch ubuntu:18.04 mycontainer
$ lxc config show mycontainer --expanded
architecture: x86_64
config:
  boot.autostart: "false"
...
$ 
3 Likes

Thanks

Hi, I’m trying to do this on lxd 4.0.9, but it doesn’t seem to be working. I have set the boot.autostart key to false in the default profile, and verified this with lxc profile get. However, when I launch a new container, it doesn’t seem to respect this change:

$ lxc launch ubuntu:20.04 mycontainer
$ lxc config get mycontainer boot.autostart
<no output>

That’s normal, look at lxc config get --expanded to get the config with profiles applied, otherwise it just queries the instance specific config.