Docker

Why is Docker Build Not Showing Any Output From Commands?

Docker “build” is one of the main commands of the Docker tool used to create images through Dockerfile. Docker images are used to instruct the Docker containers on running and managing applications. However, users may face the problem that while using the “docker build” command to create Docker images, no output, such as reference or cache status, is displayed by the commands provided in the Dockerfile.

This blog will demonstrate why Docker builds do not show any output from commands.

Why is “docker build” Not Showing Any Output From Commands?

The users that use the older version of the Docker application on Windows sometimes cannot get the output of the commands during the execution of the “docker build” command. This is because they get output from Buildkit, which replaces the previous or base Buildkit. To see the output of commands during the “docker build” execution for image creation, utilize the “–progress=plain” option.

For this purpose, we have offered the procedure for executing the “docker build” command to show the output of commands.

Step 1: Open Visual Studio Code

First, open the Visual Studio Code editor via the Windows Start menu:

Step 2: Create DockerFile

Create a new Docker file in the project directory by clicking on the highlighted icon and name the file “Dockerfile”:

Paste the given code in “Dockerfile”. These instructions will install some Python modules and then display the output “Docker is more simple Deployment Tool”:

FROM python:3.6

RUN apt-get update && apt-get install -y --no-install-recommends \

python3-setuptools \

python3-pip \

python3-dev \

python3-venv \

git \

&& \

apt-get clean && \

rm -rf /var/lib/apt/lists/*

EXPOSE 8000

CMD python -c "print('Docker is more simple Deployment Tool')"

Step 3: Run “docker build” Command

Next, execute the provided command to build the Docker image. The “-t” flag is utilized to specify the image name:

$ docker build -t pythonimage .

You can see that the commands were executed but not displaying any output:

Step 4: Run “docker build” Command to Show Command Output

Now, execute the same “docker build” command along with the “–progress=plain” option to view the output of the commands:

$ docker build --progress=plain .

It can be observed that we have successfully shown the output of the commands during the “docker build” execution:

Step 5: Run Docker Image

Next, run the Docker image with the help of the stated command:

$ docker run -it pythonimage

We have explained why the “docker build” is not showing any output from commands and how to fix it.

Conclusion

The reason behind the “docker build” not showing any output from commands is that the Docker users are getting output from Buildkit that is a replacement of the previous or base Buildkit in the new Docker version. To view the command’s output during the “docker build” command, utilize the “–progress=plain” option along with the command. This post demonstrated why the “docker build” is not showing any output from commands and how to resolve it.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.