Search code examples
centoscontainerslxc

Unable to create lxc container on centos "lxc_container: utils.c: get_template_path: 1128 No such file or directory - bad template: centos"


I am trying to create an lxc container on centos but I am running into the following error: [user@sdn3-lnx-01 ~]$ lxc-create -t centos -n container1

lxc_container: utils.c: get_template_path: 1128 No such file or directory - bad template: centos

lxc_container: lxccontainer.c: lxcapi_create: 1223 bad template: centos

lxc_container: lxc_create.c: main: 274 Error creating container container1

[user@sdn3-lnx-01 ~]$

Could you please help me?


Solution

  • Try:

    lxc-create -n container-name -t /etc/lxc/templates/lxc-centos --lxcpath=/var/lib/lxc/
    

    You can also try:

    lxc-create -n container-name -t /usr/share/lxc/templates/lxc-centos --lxcpath=/var/lib/lxc/
    

    Basically, check which folder contains your template, /etc/lxc/templates/ or /usr/share/lxc/templates/