cli: docker build exits successfully but no built image show up in the docker images

Description i have successfully run docker build command but image does not show up in the docker images command.

Steps to reproduce the issue: Using the Dockerfile:

FROM python:3
WORKDIR /usr/src/app
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000
CMD ["python", "./app.py"]

Describe the results you received: Successfully build builds image and exits successfully, but the image named “manjeet28/catnip:latest” does not show up in the docker images command.

docker build -t manjeet28/catnip .
Sending build context to Docker daemon  8.704kB
Step 1/6 : FROM python:3
3: Pulling from library/python
d6ff36c9ec48: Pull complete 
c958d65b3090: Pull complete 
edaf0a6b092f: Pull complete 
80931cf68816: Pull complete 
bc1b8aca3825: Pull complete 
edfe96a4dd20: Pull complete 
4e7c0e94bdeb: Pull complete 
8dffdfc294e3: Pull complete 
036c588c629e: Pull complete 
Digest: sha256:2c1045587e4452d49544c6dce92efe21c3b4b33864cfb56fdee66a2c8585c769
Status: Downloaded newer image for python:3
 ---> 79cc46abd78d
Step 2/6 : WORKDIR /usr/src/app
 ---> Running in 273df206b7be
Removing intermediate container 273df206b7be
 ---> 7726cbc419bb
Step 3/6 : COPY . .
 ---> 6b71a105b7bd
Step 4/6 : RUN pip install --no-cache-dir -r requirements.txt
 ---> Running in b1c52400d86d
Collecting Flask==1.0
  Downloading Flask-1.0-py2.py3-none-any.whl (97 kB)
Collecting itsdangerous>=0.24
  Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Collecting Jinja2>=2.10
  Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
Collecting Werkzeug>=0.14
  Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
Collecting click>=5.1
  Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting MarkupSafe>=0.23
  Downloading MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl (32 kB)
Installing collected packages: itsdangerous, MarkupSafe, Jinja2, Werkzeug, click, Flask
Successfully installed Flask-1.0 Jinja2-2.11.2 MarkupSafe-1.1.1 Werkzeug-1.0.1 click-7.1.2 itsdangerous-1.1.0
Removing intermediate container b1c52400d86d
 ---> b035e1019f17
Step 5/6 : EXPOSE 5000
 ---> Running in 11a623ec3d1f
Removing intermediate container 11a623ec3d1f
 ---> 771b073d5225
Step 6/6 : CMD ["python", "./app.py"]
 ---> Running in d3d8abcdaac1
Removing intermediate container d3d8abcdaac1
 ---> 58eff21b7c69
Successfully built 58eff21b7c69
Successfully tagged manjeet28/catnip:latest

Describe the results you expected: image should show up in the docker images command

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        369ce74a3c
 Built:             Fri Feb 28 23:45:43 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.6
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       369ce74a3c
  Built:            Wed Feb 19 01:06:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu1~18.04.2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:        

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 23
  Running: 12
  Paused: 0
  Stopped: 11
 Images: 9
 Server Version: 19.03.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 
 runc version: 
 init version: 
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.3.0-28-generic
 Operating System: Ubuntu 18.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.458GiB
 Name: kubernetes-master
 ID: W2WL:T6CQ:K4FW:6JSD:77JE:XZTX:SPS2:CDC7:AXC2:QXZO:W4TM:UMJ5
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: manjeet28
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.): os : ubuntu 18.04

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 45 (12 by maintainers)

Most upvoted comments

just add --load at the end of the commande

Try this in ubuntu sudo docker image ls

I was seeing this problem. docker buildx ls showed I had three builders including an unused one from a since-removed desktop-linux install. I was currently using the third - not the default - that I had set up a long time ago.

docker buildx rm --all-inactive removed the desktop linux one. docker buildx use default switched back to the original builder.

The same docker buildx build ... -t mytag . that failed to leave anything that docker images ls could find now works properly.

Not sure if this will work for anyone else, but hopefully it’s a helpful data point.

This is with: Docker version 20.10.16 build aa7e414 github.com/docker/buildx v0.8.2-docker 6224def4dd2c3d347eee19db595348c50d7cb491

Try this in ubuntu sudo docker image ls

This got me to a solution to this problem - the mistake I made was doing: sudo docker build which builds an image only root can see - this won’t appear in Docker Desktop. Similarly it will force you to sudo docker run which also won’t show up in Docker Desktop. Rebuild and run without sudo and it works!

It might be that you have done a docker buildx install in the past so docker build will be docker buildx build and you have created a docker-container builder that will not load the image by default in docker store. If you could provide the output of the following commands, that would help to see what’s wrong:

$ docker buildx ls
$ cat ~/.docker/config.json | jq '.aliases'

I was doing docker images ls, when I should have been doing docker images -a

same issue for me as well on mac apple silicon, not showing in docker images or ps, build no error

exporting layers 9.6s => => writing image sha256:a73cf62e0ed8ad4125084887918209df5a9ddd75572af 0.0s => => naming to docker.io/library/money-api

got same issue for mac, not showing in docker images, but build no error

Hi there. @manjeetsorout can you run your docker build command and paste here the output from docker images?

docker build -t image_id .
docker images > output.txt

I checked with someone who’s working on compose, and there was indeed an issue around this; see https://github.com/docker/compose/pull/9261 - that fix is in the compose v2.3.4 and above, and will be included in the next release of Docker Desktop (to be released soon)

What worked for me was to delete the previously-created version image. (With the same name/tag)

@daithi-coombes in your example, I see you’re not setting -t / --tag, which means no image will be tagged; can you see a new image appear if you docker build / docker buildx build with a --tag set?

I’m having the same issue. These won’t work, the all look like they build from cache but don’t register the new image with docker.

docker build .
docker buildx build --platform linux/amd64 --load .
docker buildx build --platform linux/amd64 --progress=plain --load .

How ever, the only command I can get to build is:

docker buildx build --progress=plain --load .

My issue is I need to specify --platform linux/amd64 as I’m on the apple m1 chipset. So am blocked here.

Client:
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df350
 Built:             Wed Jun  2 11:56:23 2021
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:55:36 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0