-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add option to wrap long commands - Layer Details #356
Comments
It’s not difficult, it’s impossible to use, because you just can’t see all the line. |
Until this is fixed, the commands can be looked up like this: docker history <IMAGE> --format "{{.CreatedBy}}" --no-trunc |
I wouldn't necessarily call that a "best practice". At least not in many contexts for all kinds of images. It completely discards all use of docker build cache for example. It depends heavily on how often you have to change things in the Image. However, this is indeed common with docker images, which are offered as popular base images, not being changed much or generally used as base image and thus not being able to afford many layers (silly layer limitation of docker or aufs). Many layers are usually created on top of common base images, for the specific use cases of the user. For example I might need a base Debian Python image. Then I install tools and a web service on that image. I would be foolish to put everything into 1 huge command, as I would have no cache at all during development and waste lots of time and computing resources. However, one might still have very long commands, even when not putting everything into one command. That is simply due to environment variables and flags of commands. Thus a way is needed to view the complete commands somehow. Of course this can de done outside of dive, as mentioned in a previous comment, but it would be nice to have a good way inside the tool. |
Somewhat related: Instead of long one-line commands, heredoc syntax can be used for multi-line commands. Showing this in dive is currently broken, I've sent a fix in #443. This is a cleaner way to unify some long commands, and after my fix is quite usable in many cases. (It's a much simpler fix than reasonably wrapping the long commands, I think, so perhaps a useful workaround for now) |
see docker layer history via cli use dive cli$ dive IMAGE:TAG -j dive.out
$ cat dive.out | jq '.layer' use docker cli$ docker save -o save.tar IMAGE:TAG
$ tar --wildcards -Oxf save.tar *.json | jq '.history?[] | select(.empty_layer!=true)' // this will filter-out empty layer, like dive does // seems $ docker history IMAGE:TAG --format '{{.CreatedBy}}' --no-trunc | tac |
Cursor behavior in |
Note: this is partially addressed in #399 |
With modern Dockerfiles that follow the best practices guides, a lot of images have few layers with very long commands. It's difficult to browse these in
dive
, as the command gets cut off.For example, looking at a recent
python
image:dive python:3.8-slim-buster
The highlighted line corresponds to this command in the Dockerfile:
https://github.com/docker-library/python/blob/e0e01b8482ea14352c710134329cdd93ece88317/3.8/buster/slim/Dockerfile#L28-L102
Is there any possibility of adding a
Wrap
toggle for theLayer Details
pane, so that the user could expand and view the whole layer command if they desire?The text was updated successfully, but these errors were encountered: