Hello.
I am trying to start a container and i receive this
‘’’
Error: Failed creating instance record: Add instance info to the database: This instance already exists
‘’’
How am i suppose to fix it ?
If i am doing lxc list there isn’ any container
@tomp @stgraber
This happens only when i execute
sudo lxc launch DetectionSvc DetectionSvc --profile default --profile ip200
from inside a python script with subprocess.Popen()
When i am executing at terminal everything works fine and the container is created.
In fact, the container always created and i am getting this error also when i am trying to launch the container from inside the Python script.
I am confused. Can i somehow clean the database ?
This is the first time that something like this has occured to me.
command4LXD = [‘lxc’,‘launch’,‘DetectionSvc’,‘DetectionSvc’,’–profile’,‘default’,’–profile’,‘ip200’]
subprocess.Popen(command4LXD,stdout=self.flog)
Is there any other way to achieve the what i want through a python script ?
Create a container with pylxd is not described clearly at the docs
stgraber
(Stéphane Graber)
4
Try stdin=None
or something along those lines, lxc launch
reads stuff from stdin if it’s available.
I did it like this :
config = {'name': 'DetectionSvc', 'source': {'type': 'image', 'alias': 'DetectionSvc'},'profiles': ['default','ip200']}
DetectionSvcContainer = lxd.containers.create(config, wait=True)
DetectionSvcContainer.start(wait=True)
Happy New Year to everyone.