How to get the creation date of a docker volume without using the docker gui for windows. With debian linux there is no gui for that. In VS Code with docker extension there is also no way to see the creation date.
with inspect it is possible but if i have many volumes with cryptic names it is hard to determine which one was created last
is there a convienient way with linux terminal to list those date sorted?
i tried inspect ---> docker volume inspect
CodePudding user response:
You could use the jq
command to extract the informaiton you want from docker volume inspect
:
docker volume ls --format '{{ .Name }}' |
xargs -n1 docker volume inspect |
jq -r '.[0]|[.Name, .CreatedAt]|@tsv' |
sort -k2
Which on my system produces something like:
exvpn_ssh_data 2022-10-30T22:40:34-04:00
exvpn_ssh_hostkeys 2022-10-30T23:04:21-04:00
exvpn_vpn_status 2022-10-31T23:18:20-04:00
postfix_mailboxes 2022-12-18T11:02:04-05:00
postfix_postgres_data 2022-12-18T11:02:04-05:00
postfix_greylist_data 2022-12-18T11:02:05-05:00
postfix_postfix_spool 2022-12-18T11:02:05-05:00
postfix_postfix_data 2022-12-18T11:02:07-05:00
postfix_postfix_config 2022-12-18T11:02:07-05:00
postfix_sockets 2022-12-18T19:46:59-05:00
Note that we're sorting things lexically, but because of the way the dates are written that ends up also being a chronological sort.