Skip to content

Instantly share code, notes, and snippets.

@AdamIsrael
Last active June 7, 2018 19:16
Show Gist options
  • Save AdamIsrael/02f07ff622b93faf0c1d9904ccdd0bba to your computer and use it in GitHub Desktop.
Save AdamIsrael/02f07ff622b93faf0c1d9904ccdd0bba to your computer and use it in GitHub Desktop.
pylxd testing

An example of connecting to your local LXD daemon.

#!/usr/bin/env python3
from pylxd import Client
import os
# Use the cert generated the first time `lxc list` is run.
crt = os.path.expanduser('~/.config/lxc/client.crt')
key = os.path.expanduser('~/.config/lxc/client.key')
client = Client(
endpoint="https://127.0.0.1:8443",
cert=(crt, key),
verify=False,
)
containers = client.containers.all()
print(containers)
@AdamIsrael
Copy link
Author

lxd version: 3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment