Docker Community Forums

Share and learn in the Docker community.

Docker build stopped without error at RUN stage

I tried to build image, but it stopped at RUN stage for some reason.
But there’s no error log.
It Just Stopped.

I ran this.

docker build --no-cache .

And here’s the result.

PS D:\wd> docker build --no-cache .
[+] Building 2.5s (6/11)
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 222B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/python:3.8-alpine                                               2.1s
 => [auth] library/python:pull token for registry-1.docker.io                                                      0.0s
 => CACHED [1/6] FROM docker.io/library/python:3.8-alpine@sha256:4d524d260eaee0d67e72013e533378192b930ef919d89a64  0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 315B                                                                                  0.0s
 => [2/6] RUN mkdir /code                                                                                                 0.1s
PS D:\wd

at RUN, just stopped.

Here’s my Dockerfile.

FROM python:3
ENV PYTHONBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY . /code/
RUN pip install -r requirments.txt
ENTRYPOINT ["python", "load_data.py"]

I tried other RUN command such as

RUN ["mkdir", "/code"]
RUN ["powershell", "mkdir", "/code"]
RUN echo "p"
RUN ["echo", "p"]
RUN ["powershell", "echo", "p"]

But the build stopped at RUN command.

What should i do?
What’s the problem?
Is there any way to let me know what’s going on the end of the process?
I’m going out of my mind. :weary:

I have to start with the recommendation of disabling buildkit. I know I always recommend that when I see buildkit is used but based on experience. So first try that. You can do it in the Docker Desktop settings or you can set the environment variable DOCKER_BUILDKIT=0 globally or locally before running docker build.

If that doesn’t help alone, keep buildkit disabled and run:

docker build --no-cache --rm=false .

This way you can run docker container list --all to see the temporary build containers and their log messages. If that doesn’t help either then we have to figure out a third way, but let’s try the first two.

You should have a Docker image with everything up to the command that failed. Run that container, then exec into it and try your command to see if the problem is more obvious.

1 Like

I forgot about that --rm=false is not required when the build fails, but note that, containers will not be kept at all if buildkit is enabled. So disabling buildkit is still a necessary step.