How to sort or order results docker ps --format?
up vote
6
down vote
favorite
I haven't found any way to order my results when using docker ps
In my case I want to order by .Ports
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}"
How do I order the result?
docker
add a comment |
up vote
6
down vote
favorite
I haven't found any way to order my results when using docker ps
In my case I want to order by .Ports
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}"
How do I order the result?
docker
if you pipe and sort it? or have a look at Andy'answer from Docker Inspect Template Magic from Adrian Mouat container-solutions.com/docker-inspect-template-magic I guess you look for a docker only solution
– user2915097
Sep 12 '17 at 10:41
I don't think you can do anything golang template specific to do this. You need to build your own stuff for this. What may work is hitting the API and usingjqto sort results and display. But not sure how easy that would be
– Tarun Lalwani
Sep 12 '17 at 11:38
from webgeodatavore.com/… I seeSort only value, not the object (return array)andjq '[.features.properties.pop_est] | sort' countries.geojsonso I guess this is possible with jq (I do not have a docke ravailable at the moment, I will test later)
– user2915097
Sep 12 '17 at 11:48
andjq -R .|jq -sr 'sort_by(length)'sort by length from reddit.com/r/commandline/comments/3z9jff/jq_examples
– user2915097
Sep 12 '17 at 11:49
see also stackoverflow.com/questions/43930011/… for a similar basicdocker command | sortand ther is an issue on that subject, see github.com/moby/moby/issues/31062
– user2915097
Sep 12 '17 at 13:24
add a comment |
up vote
6
down vote
favorite
up vote
6
down vote
favorite
I haven't found any way to order my results when using docker ps
In my case I want to order by .Ports
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}"
How do I order the result?
docker
I haven't found any way to order my results when using docker ps
In my case I want to order by .Ports
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}"
How do I order the result?
docker
docker
edited Dec 7 '17 at 9:47
asked Sep 12 '17 at 9:54
Thodi
13312
13312
if you pipe and sort it? or have a look at Andy'answer from Docker Inspect Template Magic from Adrian Mouat container-solutions.com/docker-inspect-template-magic I guess you look for a docker only solution
– user2915097
Sep 12 '17 at 10:41
I don't think you can do anything golang template specific to do this. You need to build your own stuff for this. What may work is hitting the API and usingjqto sort results and display. But not sure how easy that would be
– Tarun Lalwani
Sep 12 '17 at 11:38
from webgeodatavore.com/… I seeSort only value, not the object (return array)andjq '[.features.properties.pop_est] | sort' countries.geojsonso I guess this is possible with jq (I do not have a docke ravailable at the moment, I will test later)
– user2915097
Sep 12 '17 at 11:48
andjq -R .|jq -sr 'sort_by(length)'sort by length from reddit.com/r/commandline/comments/3z9jff/jq_examples
– user2915097
Sep 12 '17 at 11:49
see also stackoverflow.com/questions/43930011/… for a similar basicdocker command | sortand ther is an issue on that subject, see github.com/moby/moby/issues/31062
– user2915097
Sep 12 '17 at 13:24
add a comment |
if you pipe and sort it? or have a look at Andy'answer from Docker Inspect Template Magic from Adrian Mouat container-solutions.com/docker-inspect-template-magic I guess you look for a docker only solution
– user2915097
Sep 12 '17 at 10:41
I don't think you can do anything golang template specific to do this. You need to build your own stuff for this. What may work is hitting the API and usingjqto sort results and display. But not sure how easy that would be
– Tarun Lalwani
Sep 12 '17 at 11:38
from webgeodatavore.com/… I seeSort only value, not the object (return array)andjq '[.features.properties.pop_est] | sort' countries.geojsonso I guess this is possible with jq (I do not have a docke ravailable at the moment, I will test later)
– user2915097
Sep 12 '17 at 11:48
andjq -R .|jq -sr 'sort_by(length)'sort by length from reddit.com/r/commandline/comments/3z9jff/jq_examples
– user2915097
Sep 12 '17 at 11:49
see also stackoverflow.com/questions/43930011/… for a similar basicdocker command | sortand ther is an issue on that subject, see github.com/moby/moby/issues/31062
– user2915097
Sep 12 '17 at 13:24
if you pipe and sort it? or have a look at Andy'answer from Docker Inspect Template Magic from Adrian Mouat container-solutions.com/docker-inspect-template-magic I guess you look for a docker only solution
– user2915097
Sep 12 '17 at 10:41
if you pipe and sort it? or have a look at Andy'answer from Docker Inspect Template Magic from Adrian Mouat container-solutions.com/docker-inspect-template-magic I guess you look for a docker only solution
– user2915097
Sep 12 '17 at 10:41
I don't think you can do anything golang template specific to do this. You need to build your own stuff for this. What may work is hitting the API and using
jq to sort results and display. But not sure how easy that would be– Tarun Lalwani
Sep 12 '17 at 11:38
I don't think you can do anything golang template specific to do this. You need to build your own stuff for this. What may work is hitting the API and using
jq to sort results and display. But not sure how easy that would be– Tarun Lalwani
Sep 12 '17 at 11:38
from webgeodatavore.com/… I see
Sort only value, not the object (return array) and jq '[.features.properties.pop_est] | sort' countries.geojson so I guess this is possible with jq (I do not have a docke ravailable at the moment, I will test later)– user2915097
Sep 12 '17 at 11:48
from webgeodatavore.com/… I see
Sort only value, not the object (return array) and jq '[.features.properties.pop_est] | sort' countries.geojson so I guess this is possible with jq (I do not have a docke ravailable at the moment, I will test later)– user2915097
Sep 12 '17 at 11:48
and
jq -R .|jq -sr 'sort_by(length)' sort by length from reddit.com/r/commandline/comments/3z9jff/jq_examples– user2915097
Sep 12 '17 at 11:49
and
jq -R .|jq -sr 'sort_by(length)' sort by length from reddit.com/r/commandline/comments/3z9jff/jq_examples– user2915097
Sep 12 '17 at 11:49
see also stackoverflow.com/questions/43930011/… for a similar basic
docker command | sort and ther is an issue on that subject, see github.com/moby/moby/issues/31062– user2915097
Sep 12 '17 at 13:24
see also stackoverflow.com/questions/43930011/… for a similar basic
docker command | sort and ther is an issue on that subject, see github.com/moby/moby/issues/31062– user2915097
Sep 12 '17 at 13:24
add a comment |
3 Answers
3
active
oldest
votes
up vote
4
down vote
If it's enough to simply sort by output column, you can use the following:
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}" | (read -r; printf "%sn" "$REPLY"; sort -k 3 )
I also added a code for skipping the table headers and sorting only ps output data.
add a comment |
up vote
4
down vote
Format and Order docker ps
List containers
docker ps
Synopsis
docker ps [--format="TEMPLATE"]
--format="TEMPLATE"
Pretty-print containers using a Go template.
Valid placeholders:
.ID - Container ID
.Image - Image ID
.Command - Quoted command
.CreatedAt - Time when the container was created.
.RunningFor - Elapsed time since the container was started.
.Ports - Exposed ports.
.Status - Container status.
.Size - Container disk size.
.Names - Container names.
.Labels - All labels assigned to the container.
.Label - Value of a specific label for this container. For example {{.Label "com.docker.swarm.cpu"}}
.Mounts - Names of the volumes mounted in this container.
Display containers with their commands
docker ps --format "{{.ID}}: {{.Command}}"
Display containers with their labels in a table
docker ps --format "table {{.ID}}t{{.Labels}}"
Display containers with their node label in a table
docker ps --format 'table {{.ID}}t{{(.Label "com.docker.swarm.node")}}'
add a comment |
up vote
2
down vote
I built a docker ps pretty print function that can be put into your .bash_profile or .bashrc file that works somewhat like an alias for docker ps. The output has color as well:
function docker () {
if [[ "$@" == "ps -p" ]]; then
command docker ps --all --format "{{.ID}}t{{.Names}}t{{.Image}}t{{.Ports}}t{{.Status}}"
| (echo -e "CONTAINER_IDtNAMEStIMAGEtPORTStSTATUS" && cat)
| awk '{printf "33[1;32m%st33[01;38;5;95;38;5;196m%st33[00m33[1;34m%st33[01;90m%s %s %s %s %s %s %s33[00mn", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10;}'
| column -s$'t' -t
| awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
else
command docker "$@"
fi
}
usage: $ docker ps -p.
EDIT: I added suggestions from the comments from @BrianVosburgh. Also, I kept forgetting to type -p so I switched the flag for this function to be -a, which is my regular usage of docker ps.
1
Nice function. : ) But I think there is an extraneous backslash in the 'awk' pattern:...196m%st...should read...196m%st....
– Brian Vosburgh
Nov 13 at 17:41
1
Also, you could sort the table with something like this:docker ps -p | awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
– Brian Vosburgh
Nov 13 at 17:59
@BrianVosburgh, yes, thanks, I removed the extraneous backslash. I'm not sure why, but it had no impact on the output. Also, the extra stuff to sort by second column (key) of name, is a nice suggestion as well, and so I've updated the original answer with your sort command.
– David John Coleman II
Nov 21 at 13:23
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
If it's enough to simply sort by output column, you can use the following:
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}" | (read -r; printf "%sn" "$REPLY"; sort -k 3 )
I also added a code for skipping the table headers and sorting only ps output data.
add a comment |
up vote
4
down vote
If it's enough to simply sort by output column, you can use the following:
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}" | (read -r; printf "%sn" "$REPLY"; sort -k 3 )
I also added a code for skipping the table headers and sorting only ps output data.
add a comment |
up vote
4
down vote
up vote
4
down vote
If it's enough to simply sort by output column, you can use the following:
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}" | (read -r; printf "%sn" "$REPLY"; sort -k 3 )
I also added a code for skipping the table headers and sorting only ps output data.
If it's enough to simply sort by output column, you can use the following:
docker ps -a --format "table {{.ID}}t{{.Names}}t{{.Ports}}" | (read -r; printf "%sn" "$REPLY"; sort -k 3 )
I also added a code for skipping the table headers and sorting only ps output data.
edited Apr 23 at 5:47
Rob♦
23.5k115072
23.5k115072
answered Apr 23 at 3:43
Art-Rock Guitar Superhero
617
617
add a comment |
add a comment |
up vote
4
down vote
Format and Order docker ps
List containers
docker ps
Synopsis
docker ps [--format="TEMPLATE"]
--format="TEMPLATE"
Pretty-print containers using a Go template.
Valid placeholders:
.ID - Container ID
.Image - Image ID
.Command - Quoted command
.CreatedAt - Time when the container was created.
.RunningFor - Elapsed time since the container was started.
.Ports - Exposed ports.
.Status - Container status.
.Size - Container disk size.
.Names - Container names.
.Labels - All labels assigned to the container.
.Label - Value of a specific label for this container. For example {{.Label "com.docker.swarm.cpu"}}
.Mounts - Names of the volumes mounted in this container.
Display containers with their commands
docker ps --format "{{.ID}}: {{.Command}}"
Display containers with their labels in a table
docker ps --format "table {{.ID}}t{{.Labels}}"
Display containers with their node label in a table
docker ps --format 'table {{.ID}}t{{(.Label "com.docker.swarm.node")}}'
add a comment |
up vote
4
down vote
Format and Order docker ps
List containers
docker ps
Synopsis
docker ps [--format="TEMPLATE"]
--format="TEMPLATE"
Pretty-print containers using a Go template.
Valid placeholders:
.ID - Container ID
.Image - Image ID
.Command - Quoted command
.CreatedAt - Time when the container was created.
.RunningFor - Elapsed time since the container was started.
.Ports - Exposed ports.
.Status - Container status.
.Size - Container disk size.
.Names - Container names.
.Labels - All labels assigned to the container.
.Label - Value of a specific label for this container. For example {{.Label "com.docker.swarm.cpu"}}
.Mounts - Names of the volumes mounted in this container.
Display containers with their commands
docker ps --format "{{.ID}}: {{.Command}}"
Display containers with their labels in a table
docker ps --format "table {{.ID}}t{{.Labels}}"
Display containers with their node label in a table
docker ps --format 'table {{.ID}}t{{(.Label "com.docker.swarm.node")}}'
add a comment |
up vote
4
down vote
up vote
4
down vote
Format and Order docker ps
List containers
docker ps
Synopsis
docker ps [--format="TEMPLATE"]
--format="TEMPLATE"
Pretty-print containers using a Go template.
Valid placeholders:
.ID - Container ID
.Image - Image ID
.Command - Quoted command
.CreatedAt - Time when the container was created.
.RunningFor - Elapsed time since the container was started.
.Ports - Exposed ports.
.Status - Container status.
.Size - Container disk size.
.Names - Container names.
.Labels - All labels assigned to the container.
.Label - Value of a specific label for this container. For example {{.Label "com.docker.swarm.cpu"}}
.Mounts - Names of the volumes mounted in this container.
Display containers with their commands
docker ps --format "{{.ID}}: {{.Command}}"
Display containers with their labels in a table
docker ps --format "table {{.ID}}t{{.Labels}}"
Display containers with their node label in a table
docker ps --format 'table {{.ID}}t{{(.Label "com.docker.swarm.node")}}'
Format and Order docker ps
List containers
docker ps
Synopsis
docker ps [--format="TEMPLATE"]
--format="TEMPLATE"
Pretty-print containers using a Go template.
Valid placeholders:
.ID - Container ID
.Image - Image ID
.Command - Quoted command
.CreatedAt - Time when the container was created.
.RunningFor - Elapsed time since the container was started.
.Ports - Exposed ports.
.Status - Container status.
.Size - Container disk size.
.Names - Container names.
.Labels - All labels assigned to the container.
.Label - Value of a specific label for this container. For example {{.Label "com.docker.swarm.cpu"}}
.Mounts - Names of the volumes mounted in this container.
Display containers with their commands
docker ps --format "{{.ID}}: {{.Command}}"
Display containers with their labels in a table
docker ps --format "table {{.ID}}t{{.Labels}}"
Display containers with their node label in a table
docker ps --format 'table {{.ID}}t{{(.Label "com.docker.swarm.node")}}'
edited Oct 2 at 0:32
answered Sep 12 '17 at 13:45
Jinna Balu
1,194916
1,194916
add a comment |
add a comment |
up vote
2
down vote
I built a docker ps pretty print function that can be put into your .bash_profile or .bashrc file that works somewhat like an alias for docker ps. The output has color as well:
function docker () {
if [[ "$@" == "ps -p" ]]; then
command docker ps --all --format "{{.ID}}t{{.Names}}t{{.Image}}t{{.Ports}}t{{.Status}}"
| (echo -e "CONTAINER_IDtNAMEStIMAGEtPORTStSTATUS" && cat)
| awk '{printf "33[1;32m%st33[01;38;5;95;38;5;196m%st33[00m33[1;34m%st33[01;90m%s %s %s %s %s %s %s33[00mn", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10;}'
| column -s$'t' -t
| awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
else
command docker "$@"
fi
}
usage: $ docker ps -p.
EDIT: I added suggestions from the comments from @BrianVosburgh. Also, I kept forgetting to type -p so I switched the flag for this function to be -a, which is my regular usage of docker ps.
1
Nice function. : ) But I think there is an extraneous backslash in the 'awk' pattern:...196m%st...should read...196m%st....
– Brian Vosburgh
Nov 13 at 17:41
1
Also, you could sort the table with something like this:docker ps -p | awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
– Brian Vosburgh
Nov 13 at 17:59
@BrianVosburgh, yes, thanks, I removed the extraneous backslash. I'm not sure why, but it had no impact on the output. Also, the extra stuff to sort by second column (key) of name, is a nice suggestion as well, and so I've updated the original answer with your sort command.
– David John Coleman II
Nov 21 at 13:23
add a comment |
up vote
2
down vote
I built a docker ps pretty print function that can be put into your .bash_profile or .bashrc file that works somewhat like an alias for docker ps. The output has color as well:
function docker () {
if [[ "$@" == "ps -p" ]]; then
command docker ps --all --format "{{.ID}}t{{.Names}}t{{.Image}}t{{.Ports}}t{{.Status}}"
| (echo -e "CONTAINER_IDtNAMEStIMAGEtPORTStSTATUS" && cat)
| awk '{printf "33[1;32m%st33[01;38;5;95;38;5;196m%st33[00m33[1;34m%st33[01;90m%s %s %s %s %s %s %s33[00mn", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10;}'
| column -s$'t' -t
| awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
else
command docker "$@"
fi
}
usage: $ docker ps -p.
EDIT: I added suggestions from the comments from @BrianVosburgh. Also, I kept forgetting to type -p so I switched the flag for this function to be -a, which is my regular usage of docker ps.
1
Nice function. : ) But I think there is an extraneous backslash in the 'awk' pattern:...196m%st...should read...196m%st....
– Brian Vosburgh
Nov 13 at 17:41
1
Also, you could sort the table with something like this:docker ps -p | awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
– Brian Vosburgh
Nov 13 at 17:59
@BrianVosburgh, yes, thanks, I removed the extraneous backslash. I'm not sure why, but it had no impact on the output. Also, the extra stuff to sort by second column (key) of name, is a nice suggestion as well, and so I've updated the original answer with your sort command.
– David John Coleman II
Nov 21 at 13:23
add a comment |
up vote
2
down vote
up vote
2
down vote
I built a docker ps pretty print function that can be put into your .bash_profile or .bashrc file that works somewhat like an alias for docker ps. The output has color as well:
function docker () {
if [[ "$@" == "ps -p" ]]; then
command docker ps --all --format "{{.ID}}t{{.Names}}t{{.Image}}t{{.Ports}}t{{.Status}}"
| (echo -e "CONTAINER_IDtNAMEStIMAGEtPORTStSTATUS" && cat)
| awk '{printf "33[1;32m%st33[01;38;5;95;38;5;196m%st33[00m33[1;34m%st33[01;90m%s %s %s %s %s %s %s33[00mn", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10;}'
| column -s$'t' -t
| awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
else
command docker "$@"
fi
}
usage: $ docker ps -p.
EDIT: I added suggestions from the comments from @BrianVosburgh. Also, I kept forgetting to type -p so I switched the flag for this function to be -a, which is my regular usage of docker ps.
I built a docker ps pretty print function that can be put into your .bash_profile or .bashrc file that works somewhat like an alias for docker ps. The output has color as well:
function docker () {
if [[ "$@" == "ps -p" ]]; then
command docker ps --all --format "{{.ID}}t{{.Names}}t{{.Image}}t{{.Ports}}t{{.Status}}"
| (echo -e "CONTAINER_IDtNAMEStIMAGEtPORTStSTATUS" && cat)
| awk '{printf "33[1;32m%st33[01;38;5;95;38;5;196m%st33[00m33[1;34m%st33[01;90m%s %s %s %s %s %s %s33[00mn", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10;}'
| column -s$'t' -t
| awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
else
command docker "$@"
fi
}
usage: $ docker ps -p.
EDIT: I added suggestions from the comments from @BrianVosburgh. Also, I kept forgetting to type -p so I switched the flag for this function to be -a, which is my regular usage of docker ps.
edited Nov 21 at 13:30
answered Oct 20 at 18:21
David John Coleman II
340410
340410
1
Nice function. : ) But I think there is an extraneous backslash in the 'awk' pattern:...196m%st...should read...196m%st....
– Brian Vosburgh
Nov 13 at 17:41
1
Also, you could sort the table with something like this:docker ps -p | awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
– Brian Vosburgh
Nov 13 at 17:59
@BrianVosburgh, yes, thanks, I removed the extraneous backslash. I'm not sure why, but it had no impact on the output. Also, the extra stuff to sort by second column (key) of name, is a nice suggestion as well, and so I've updated the original answer with your sort command.
– David John Coleman II
Nov 21 at 13:23
add a comment |
1
Nice function. : ) But I think there is an extraneous backslash in the 'awk' pattern:...196m%st...should read...196m%st....
– Brian Vosburgh
Nov 13 at 17:41
1
Also, you could sort the table with something like this:docker ps -p | awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'
– Brian Vosburgh
Nov 13 at 17:59
@BrianVosburgh, yes, thanks, I removed the extraneous backslash. I'm not sure why, but it had no impact on the output. Also, the extra stuff to sort by second column (key) of name, is a nice suggestion as well, and so I've updated the original answer with your sort command.
– David John Coleman II
Nov 21 at 13:23
1
1
Nice function. : ) But I think there is an extraneous backslash in the 'awk' pattern:
...196m%st... should read ...196m%st....– Brian Vosburgh
Nov 13 at 17:41
Nice function. : ) But I think there is an extraneous backslash in the 'awk' pattern:
...196m%st... should read ...196m%st....– Brian Vosburgh
Nov 13 at 17:41
1
1
Also, you could sort the table with something like this:
docker ps -p | awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'– Brian Vosburgh
Nov 13 at 17:59
Also, you could sort the table with something like this:
docker ps -p | awk 'NR<2{print $0;next}{print $0 | "sort --key=2"}'– Brian Vosburgh
Nov 13 at 17:59
@BrianVosburgh, yes, thanks, I removed the extraneous backslash. I'm not sure why, but it had no impact on the output. Also, the extra stuff to sort by second column (key) of name, is a nice suggestion as well, and so I've updated the original answer with your sort command.
– David John Coleman II
Nov 21 at 13:23
@BrianVosburgh, yes, thanks, I removed the extraneous backslash. I'm not sure why, but it had no impact on the output. Also, the extra stuff to sort by second column (key) of name, is a nice suggestion as well, and so I've updated the original answer with your sort command.
– David John Coleman II
Nov 21 at 13:23
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46173298%2fhow-to-sort-or-order-results-docker-ps-format%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
if you pipe and sort it? or have a look at Andy'answer from Docker Inspect Template Magic from Adrian Mouat container-solutions.com/docker-inspect-template-magic I guess you look for a docker only solution
– user2915097
Sep 12 '17 at 10:41
I don't think you can do anything golang template specific to do this. You need to build your own stuff for this. What may work is hitting the API and using
jqto sort results and display. But not sure how easy that would be– Tarun Lalwani
Sep 12 '17 at 11:38
from webgeodatavore.com/… I see
Sort only value, not the object (return array)andjq '[.features.properties.pop_est] | sort' countries.geojsonso I guess this is possible with jq (I do not have a docke ravailable at the moment, I will test later)– user2915097
Sep 12 '17 at 11:48
and
jq -R .|jq -sr 'sort_by(length)'sort by length from reddit.com/r/commandline/comments/3z9jff/jq_examples– user2915097
Sep 12 '17 at 11:49
see also stackoverflow.com/questions/43930011/… for a similar basic
docker command | sortand ther is an issue on that subject, see github.com/moby/moby/issues/31062– user2915097
Sep 12 '17 at 13:24