Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to pause a Docker image build?

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) ?

like image 692
conradkleinespel Avatar asked Jul 11 '15 20:07

conradkleinespel


People also ask

How do I pause a docker build?

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.

Is it possible to pause a docker container?

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.

How do I stop a docker image?

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.

What is the difference between docker pause and stop?

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.


1 Answers

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
like image 54
Thomasleveil Avatar answered Oct 26 '22 11:10

Thomasleveil