I sometimes get warnings or non fatal errors when building an image. For instance, if I compile some program inside a Docker image, but some optional library is missing, a warning is printed.
But if the image keeps building, the message is difficult to retrieve, because the terminal keeps scrolling down and at some point, it is too high up to be readable.
Is it possible to pause a Docker image or to retrieve these error messages some other way than outputting to a file (which might loose the coloring the terminal has) ?
Pause Container If we want to pause the processes running inside the container, we can use the “docker pause” command. To unpause the container, use “docker unpause” command.
The docker pause command suspends all processes in the specified containers. On Linux, this uses the freezer cgroup. Traditionally, when suspending a process the SIGSTOP signal is used, which is observable by the process being suspended.
To stop a container you use the docker stop command and pass the name of the container and the number of seconds before a container is killed. The default number of seconds the command will wait before the killing is 10 seconds.
The Docker pause command is used to pause an existing Docker container. The Docker stop command is used to pause an existing Docker container. The Docker run command is used to put a container back from a stopped state to a running state.
Is it possible to pause a Docker image
no, you cannot pause the docker build
command.
You could give a try to the Scroll Lock key, but depending on your terminal that might fail.
You could pipe the result of the docker build
command to less -R
:
docker build -t test . | less -R
Once built, you can then use the arrow keys to go up and down, use /
to search for test, etc.
-R
is to keep colors
-r -R .... --raw-control-chars --RAW-CONTROL- Output "raw" control characters.
Also you can record the output to a file (I know you explicitly said you don't want this solution, but it can suit others):
docker build -t test . | tee build.log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With