docker / docker/cli

Unable to easily sort images by size

Open
#2,406 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/ux kind/enhancement
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

It leads to complicated solutions like https://github.com/pixelastic/oroshi/blob/master/scripts/bin/docker-image-list which I don't believe is necessary

Steps to reproduce the issue:

  1. create or pull some images if you don't have any
  2. docker images | sort -k5 -h

Describe the results you received:
image list NOT sorted by size

Describe the results you expected:
image list sorted by size

Additional information you deem important (e.g. issue happens only occasionally):
Probably caused by the fact that there is no tab character between the columns

Output of docker version:

Client:
 Version:           18.09.7
 API version:       1.39
 Go version:        go1.10.1
 Git commit:        2d0083d
 Built:             Fri Aug 16 14:20:06 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.09.7
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.1
  Git commit:       2d0083d
  Built:            Wed Aug 14 19:41:23 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

Containers: 19
 Running: 0
 Paused: 0
 Stopped: 19
Images: 149
Server Version: 18.09.7
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 
runc version: N/A
init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-72-generic
Operating System: Ubuntu 18.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 4.748GiB
Name: ms580j-VirtualBox
ID: 57FN:MW4D:2TJZ:UE3U:YU5T:IZD3:UERB:T7QC:GH35:BXWO:KAZX:K2AJ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: http://135.28.13.11:8888
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):
Virtualbox

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the docker images CLI command and the code that formats its image-list output. Reproduce the issue with several images and docker images | sort -k5 -h, then inspect the column separation and existing tests. Done means the displayed size column can be sorted numerically with the documented command.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.