ingobaab
(Ingo Baab)
March 14, 2023, 1:21pm
1
Hello Everyone,
how can I list only one container with lxc list
if I have others with the same string in the beginning? I want to only show one specific container addresses by the exact name.
Example:
I dont want to list others that beginn with the same substring… If I have ‘wordpress ’ and ‘wordpress-live ’ and ‘wordpress-stage ’ - how can I only list that one, with the name ‘wordpress ’?
You can use regex to filter out other names, so to do what you want you could do lxc list wordpress$
and it would only display that container
ex without regex
$ lxc list u1
±---------±--------±----------------------±----------------------------------------------±----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±---------±--------±----------------------±----------------------------------------------±----------±----------+
| u1 | RUNNING | 10.141.245.237 (eth0) | | CONTAINER | 0 |
±---------±--------±----------------------±----------------------------------------------±----------±----------+
| u1-live | RUNNING | 10.141.245.174 (eth0) | | CONTAINER | 0 |
±---------±--------±----------------------±----------------------------------------------±----------±----------+
| u1-stage | RUNNING | 10.141.245.56 (eth0) | | CONTAINER | 0 |
±---------±--------±----------------------±----------------------------------------------±----------±----------+
With the regex
$ lxc list u1$
±-----±--------±----------------------±----------------------------------------------±----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±-----±--------±----------------------±----------------------------------------------±----------±----------+
| u1 | RUNNING | 10.141.245.237 (eth0) | | CONTAINER | 0 |
±-----±--------±----------------------±----------------------------------------------±----------±----------+
3 Likes
ingobaab
(Ingo Baab)
March 16, 2023, 3:56am
3
Oh. Great. Thank you @zac.fuller ! Nice community here.