Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker CLI display poor output based on command docker image history --no-trunc <image_name> from Power Shell. #3329

Open
krave1986 opened this issue Oct 8, 2021 · 1 comment

Comments

@krave1986
Copy link

Description

I am going to check image history in full by issue command:
docker image history --no-trunc <image_name>

But the output of this command is very hard to read.
I have to scroll down lines to read info comming next.

Here is how it looks:
image

Is there any solution to this problem?

Steps to reproduce the issue:

  1. Open Windows Terminal with Power Shell as the default shell
  2. Issue command docker image history --no-trunc <any_image_name_available>

Describe the results you received:
Text ouput in poor format and hard to read.

Describe the results you expected:
I expect to read the --no-trunc version in less like how journalctl works on Ubuntu.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Cloud integration: 1.0.17
 Version:           20.10.8
 API version:       1.41
 Go version:        go1.16.6
 Git commit:        3967b7d
 Built:             Fri Jul 30 19:58:50 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.8
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.6
  Git commit:       75249d8
  Built:            Fri Jul 30 19:52:10 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.9
  GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
 runc:
  Version:          1.0.1
  GitCommit:        v1.0.1-0-g4144b63
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info:

IMAGE                                                                     CREATED       CREATED BY                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    





               SIZE      COMMENT
sha256:92ac412a6ac78d12eb713ce24f8dacbfc57712f3fcd7bf78ffb876f51c5ab894   9 days ago    CMD ["node" "src/index.js"]



















               0B        buildkit.dockerfile.v0
<missing>                                                                 9 days ago    RUN /bin/sh -c yarn install --production # buildkit


















               85.2MB    buildkit.dockerfile.v0
<missing>                                                                 9 days ago    COPY . . # buildkit



















               4.62MB    buildkit.dockerfile.v0
<missing>                                                                 10 days ago   WORKDIR /app












                                                                                                                                     





               0B        buildkit.dockerfile.v0
<missing>                                                                 10 days ago   RUN /bin/sh -c apk add --no-cache python g++ make # buildkit


















               205MB     buildkit.dockerfile.v0
<missing>                                                                 5 weeks ago   /bin/sh -c #(nop)  CMD ["node"]



















               0B
<missing>                                                                 5 weeks ago   /bin/sh -c #(nop)  ENTRYPOINT ["docker-entrypoint.sh"]


















               0B
<missing>                                                                 5 weeks ago   /bin/sh -c #(nop) COPY file:238737301d47304174e4d24f4def935b29b3069c03c72ae8de97d94624382fce in /usr/local/bin/


















               116B
<missing>                                                                 5 weeks ago   /bin/sh -c apk add --no-cache --virtual .build-deps-yarn curl gnupg tar   && for key in     6A010C5166006599AA17F08146C2130DFD2497F5   ; do     gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ||     gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ;   done   && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz"   && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc"   && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz   && mkdir -p /opt   && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/   && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn   && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg   && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz   && apk del .build-deps-yarn   && yarn --version












               7.62MB
<missing>                                                                 5 weeks ago   /bin/sh -c #(nop)  ENV YARN_VERSION=1.22.5   


















               0B
<missing>                                                                 5 weeks ago   /bin/sh -c addgroup -g 1000 node     && adduser -u 1000 -G node -s /bin/sh -D node     && apk add --no-cache         libstdc++     && apk add --no-cache --virtual .build-deps         curl     && ARCH= && alpineArch="$(apk --print-arch)"       && case "${alpineArch##*-}" in         x86_64)           ARCH='x64'           CHECKSUM="0ce2b97ecbbd84f1a5ed13278ed6845d93c6454d8550730b247a990438dba322"           ;;         *) ;;       esac   && if [ -n "${CHECKSUM}" ]; then     set -eu;     curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz";     echo "$CHECKSUM  node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" | sha256sum -c -       && tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner       && ln -s /usr/local/bin/node /usr/local/bin/nodejs;   else     echo "Building from source"     && apk add --no-cache --virtual .build-deps-full         binutils-gold         g++         gcc         gnupg         libgcc         linux-headers         make         python2     && for key in       4ED778F539E3634C779C87C6D7062848A1AB005C       94AE36675C464D64BAFA68DD7434390BDBE9B9C5       74F12602B6F1C4E913FAA37AD3A89613643B6201       71DCFD284A79C3B38668286BC97EC7A07EDE3FC1       8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600       C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8       C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C       DD8F2338BAE7501E3DD5AC78C273792F7D83545D       A48C2BEE680E841632CD4E44F07496B3EB3C1762       108F52B48DB57BB0CC439B2997B01419BD92F80A       B9E2F5981AA6E0CD28160D9FF13993A75599653C     ; do       gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ||       gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ;     done     && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz"     && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"     && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc     && grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c -     && tar -xf "node-v$NODE_VERSION.tar.xz"     && cd "node-v$NODE_VERSION"     && ./configure     && make -j$(getconf _NPROCESSORS_ONLN) V=     && make install     && apk del .build-deps-full     && cd ..     && rm -Rf "node-v$NODE_VERSION"     && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt;   fi   && rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"   && apk del .build-deps   && node --version   && npm --version   75.7MB
<missing>                                                                 5 weeks ago   /bin/sh -c #(nop)  ENV NODE_VERSION=12.22.6  


















               0B
<missing>                                                                 5 weeks ago   /bin/sh -c #(nop)  CMD ["/bin/sh"]



















               0B
<missing>                                                                 5 weeks ago   /bin/sh -c #(nop) ADD file:9d14b11183983923090d9e6d15cc51ee210466296e913bfefbfd580b3de59c95 in /


















               5.62MB
@thaJeztah
Copy link
Member

Thanks for reporting; I think the cause for this is that the history output can be very wide (depending on what's in the history), which causes the shell to wrap the output.

I don't think there's a way to make the shell output wider than the shell itself is, other than truncating the output (but this wouldn't allow you to view each line (i.e., not allow you to horizontally scroll)).

Not sure if PowerShell is handling this different, but in a Bash terminal, I'm able to copy the output, and pasting it in an editor, I get the lines without wrapping; e.g.:

IMAGE                                                                     CREATED        CREATED BY                                                                                                                  SIZE      COMMENT
sha256:efe2d67c403ba89ab138bed5b41866eb757eb1f58d7b32df34dea7e0e79aba35   2 months ago   ENTRYPOINT ["/bin/sh"]                                                                                                      0B        buildkit.dockerfile.v0
<missing>                                                                 2 months ago   COPY /out/git-credential-docker-server /bin # buildkit                                                                      11.8MB    buildkit.dockerfile.v0
<missing>                                                                 2 months ago   COPY /out/git-credential-docker /bin # buildkit                                                                             6.74MB    buildkit.dockerfile.v0
<missing>                                                                 2 months ago   ENV SSH_AUTH_SOCK=/tmp/docker-ssh.sock                                                                                      0B        buildkit.dockerfile.v0
<missing>                                                                 2 months ago   RUN /bin/sh -c git config --global credential.helper docker # buildkit                                                      30B       buildkit.dockerfile.v0
<missing>                                                                 2 months ago   RUN /bin/sh -c apk add --no-cache findutils # buildkit                                                                      557kB     buildkit.dockerfile.v0
<missing>                                                                 4 months ago   CMD ["--help"]                                                                                                              0B        buildkit.dockerfile.v0
<missing>                                                                 4 months ago   ENTRYPOINT ["git"]                                                                                                          0B        buildkit.dockerfile.v0
<missing>                                                                 4 months ago   WORKDIR /git                                                                                                                0B        buildkit.dockerfile.v0
<missing>                                                                 4 months ago   VOLUME [/git]                                                                                                               0B        buildkit.dockerfile.v0
<missing>                                                                 4 months ago   RUN /bin/sh -c apk --update add git less openssh &&     rm -rf /var/lib/apt/lists/* &&     rm /var/cache/apk/* # buildkit   19.5MB    buildkit.dockerfile.v0
<missing>                                                                 5 months ago   /bin/sh -c #(nop)  CMD ["/bin/sh"]                                                                                          0B
<missing>                                                                 5 months ago   /bin/sh -c #(nop) ADD file:8ec69d882e7f29f0652d537557160e638168550f738d0d49f90a7ef96bf31787 in /                            5.61MB

I can also pipe the output to less with the -S option, which truncates output that doesn't fit, but that of course discards the output;

IMAGE                                                                     CREATED        CREATED BY
sha256:efe2d67c403ba89ab138bed5b41866eb757eb1f58d7b32df34dea7e0e79aba35   2 months ago   ENTRYPOINT ["/bin/sh"]
<missing>                                                                 2 months ago   COPY /out/git-credential-docker-server /bin # buildkit
<missing>                                                                 2 months ago   COPY /out/git-credential-docker /bin # buildkit
<missing>                                                                 2 months ago   ENV SSH_AUTH_SOCK=/tmp/docker-ssh.sock
<missing>                                                                 2 months ago   RUN /bin/sh -c git config --global credential.helper docker # buildkit
<missing>                                                                 2 months ago   RUN /bin/sh -c apk add --no-cache findutils # buildkit
<missing>                                                                 4 months ago   CMD ["--help"]
<missing>                                                                 4 months ago   ENTRYPOINT ["git"]
<missing>                                                                 4 months ago   WORKDIR /git
<missing>                                                                 4 months ago   VOLUME [/git]
<missing>                                                                 4 months ago   RUN /bin/sh -c apk --update add git less openssh &&     rm -rf /var/lib/apt/lists/* &&     rm /var/cache/apk/* # bu
<missing>                                                                 5 months ago   /bin/sh -c #(nop)  CMD ["/bin/sh"]
<missing>                                                                 5 months ago   /bin/sh -c #(nop) ADD file:8ec69d882e7f29f0652d537557160e638168550f738d0d49f90a7ef96bf31787 in /

You may be able to redirect the output to a file (not exactly sure what the right syntax for that is on PowerShell)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants