Difference between revisions of "Pylxd"
Jump to navigation
Jump to search
(Created page with "# Snippets ## Get IP addresses on container ``` #!usr/bin/env python3 from pylxd import Client client = Client() for p in client.containers.all(): print(p.name, p.state().net...") |
|||
Line 3: | Line 3: | ||
## Get IP addresses on container | ## Get IP addresses on container | ||
``` | ``` | ||
− | #!usr/bin/env python3 | + | #!/usr/bin/env python3 |
from pylxd import Client | from pylxd import Client | ||
client = Client() | client = Client() | ||
for p in client.containers.all(): print(p.name, p.state().network['eth0']['addresses'][0]['address']) | for p in client.containers.all(): print(p.name, p.state().network['eth0']['addresses'][0]['address']) | ||
``` | ``` |
Latest revision as of 15:47, 24 March 2020
Snippets
Get IP addresses on container
#!/usr/bin/env python3 from pylxd import Client client = Client() for p in client.containers.all(): print(p.name, p.state().network['eth0']['addresses'][0]['address'])