What does "in use" mean for an image? - docker

What does "in use" mean and how can I get that info from the CLI?
Reference: docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.State}}\t{{.Image}}"
CONTAINER ID
NAMES
STATE
IMAGE
07bce6924796
laughing_wozniak
exited
vsc-volume-bootstrap
6d37d8744a77
angry_brahmagupta
exited
vsc-quickstarts-d91f349952ba5208420f1403c31b2955-uid
0bce117a827c
dapr_placement
running
daprio/dapr:1.5.0
1232bf715593
dapr_zipkin
running
openzipkin/zipkin
c128e546a0b6
dapr_redis
running
redis
dc44e1006831
miked
exited
my-first-fsharp-web
ce3cf77a0eb9
minikube
running
gcr.io/k8s-minikube/kicbase:v0.0.28
Reference: docker image ls
REPOSITORY
TAG
IMAGE ID
CREATED
SIZE
vsc-microsoftvscodeinsiders-572e00dcd0f79c5ee8d7d39c18e7c701-features
latest
9f05ea6535d4
12 hours ago
6.36GB
vsc-volume-bootstrap
latest
81646861762b
12 hours ago
180MB
vsc-quickstarts-d91f349952ba5208420f1403c31b2955-uid
latest
453bd2943e10
40 hours ago
9.7GB
vsc-quickstarts-d91f349952ba5208420f1403c31b2955
latest
10de525681a7
40 hours ago
9.7GB
openzipkin/zipkin
latest
6a9714eacfd9
2 days ago
153MB
miked.azurecr.io/my-first-fsharp-web
96e7948ee30c
5 days ago
211MB
my-first-fsharp-web
latest
e36fabe64a1c
5 days ago
211MB
miked.azurecr.io/my-first-fsharp-web
1
e36fabe64a1c
5 days ago
211MB
miked.azurecr.io/my-first-fsharp-web
latest
e36fabe64a1c
5 days ago
211MB
counter-image
latest
22dfe0305c55
7 days ago
208MB
redis
latest
40c68ed3a4d2
8 days ago
113MB
daprio/dapr
1.5.0
bff1855a0302
2 weeks ago
214MB
vsc-azure-container-apps-demo-41dcd784881293406771e08c255554b9
latest
1af591496e8a
4 weeks ago
337MB
gcr.io/k8s-minikube/kicbase
v0.0.28
e2a6c047bedd
8 weeks ago
1.08GB

It indicates if the image is used by a container (running or already stopped).
You cannot get this via the CLI using docker images, but listing the containers docker ps -a you can see the associated image.

Related

Channel creation failed in Hyperledger Fabric building

I am trying to set up a test hyperledger fabric environment. I am using docker approach.
Orderer and 2 peer nodes started successfully. However, channel creation fails with error. Any help would be greatly appreciated.
Error: Post "https://localhost:7053/participation/v1/channels": dial tcp [::1]:7053: connect: connection refused
===> List out hyperledger docker images
hyperledger/fabric-tools 2.4 545af418d284 3 months ago 489MB
hyperledger/fabric-tools 2.4.7 545af418d284 3 months ago 489MB
hyperledger/fabric-tools latest 545af418d284 3 months ago 489MB
hyperledger/fabric-peer 2.4 d77dd7cfbcd7 3 months ago 64.2MB
hyperledger/fabric-peer 2.4.7 d77dd7cfbcd7 3 months ago 64.2MB
hyperledger/fabric-peer latest d77dd7cfbcd7 3 months ago 64.2MB
hyperledger/fabric-orderer 2.4 77c489caa81b 3 months ago 36.7MB
hyperledger/fabric-orderer 2.4.7 77c489caa81b 3 months ago 36.7MB
hyperledger/fabric-orderer latest 77c489caa81b 3 months ago 36.7MB
hyperledger/fabric-ccenv 2.4 4eb7ee7f4af5 3 months ago 520MB
hyperledger/fabric-ccenv 2.4.7 4eb7ee7f4af5 3 months ago 520MB
hyperledger/fabric-ccenv latest 4eb7ee7f4af5 3 months ago 520MB
hyperledger/fabric-baseos 2.4 b20d2dde6941 3 months ago 6.82MB
hyperledger/fabric-baseos 2.4.7 b20d2dde6941 3 months ago 6.82MB
hyperledger/fabric-baseos latest b20d2dde6941 3 months ago 6.82MB
hyperledger/fabric-ca 1.5 93f19fa873cb 7 months ago 76.5MB
hyperledger/fabric-ca 1.5.5 93f19fa873cb 7 months ago 76.5MB
hyperledger/fabric-ca latest 93f19fa873cb 7 months ago 76.5MB
sudo ./network.sh up
above is conducted successful
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0eec45f8ecd8 hyperledger/fabric-tools:latest "/bin/bash" 3 seconds ago Up Less than a second cli
d511a671b457 hyperledger/fabric-peer:latest "peer node start" 3 seconds ago Exited (1) 1 second ago peer0.org1.example.com
dfd6cf1917ee hyperledger/fabric-peer:latest "peer node start" 3 seconds ago Exited (1) 1 second ago peer0.org2.example.com
05d550a97a73 hyperledger/fabric-orderer:latest "orderer" 3 seconds ago Exited (2) Less than a second ago orderer.example.com
but when comes to the channel creating, error appears
system:mac
Have retried many times, but it is still not working.
thanks!
solutions for this question i searched in stackoverflow, that retry cannot help, include:
reload docker
re-clone
etc.

Docker no space left on device on Mac M1

I want to run container and receive error:
docker run -ti --rm grafana/promtail:2.5.0 -config.file=/etc/promtail/config.yml
docker: Error response from daemon: mkdir /var/lib/docker/overlay2/0cad6a6645e2445a9985d5c9e9c6909fa74ee1a30425b407ddfac13684bd9d31-init: no space left on device.
At first, I thought I have a lot of volumes and images cached. So I clean docker with:
docker prune
docker builder prune
But in a while, the same error occur. When I check my Docker Desktop configuration, I can see I am using all available disk size for images:
Disk image size:
59.6 GB (59.5 GB used)
I have 13 images on my system and together its less than 5GB:
REPOSITORY TAG IMAGE ID CREATED SIZE
logstashloki latest 157966144f3b 3 days ago 761MB
minio/minio <none> 717586e37f7f 4 days ago 232MB
grafana/grafana <none> 31a8875955e5 9 days ago 277MB
docker.elastic.co/beats/filebeat 8.3.2 e7b210caf528 3 weeks ago 295MB
k8s.gcr.io/kube-apiserver v1.24.0 b62a103951f4 2 months ago 126MB
k8s.gcr.io/kube-scheduler v1.24.0 b81513b3bfb4 2 months ago 50MB
k8s.gcr.io/kube-controller-manager v1.24.0 59fad34d4fe0 2 months ago 116MB
k8s.gcr.io/kube-proxy v1.24.0 66e1443684b0 2 months ago 106MB
k8s.gcr.io/etcd 3.5.3-0 a9a710bb96df 3 months ago 178MB
grafana/promtail 2.5.0 aa21fd577ae2 3 months ago 177MB
grafana/loki 2.5.0 369cbd28ef9b 3 months ago 60MB
k8s.gcr.io/pause 3.7 e5a475a03805 4 months ago 514kB
k8s.gcr.io/coredns/coredns v1.8.6 edaa71f2aee8 9 months ago 46.8MB
From output of docker system df there is no suspicious size of container, images or volumes:
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 13 13 2.35GB 69.57MB (2%)
Containers 21 21 35.15kB 0B (0%)
Local Volumes 2 0 2.186MB 2.186MB (100%)
Build Cache 20 0 0B 0B
I am new to MacOS and cannot determine what take all my space and how to clean all that space and where are all that data stored on system?

Docker-compose up -d:image not created

I am trying to create a basic web page with docker-compose
This is my yml file
identidock:
build: .
ports:
- "5000:5000"
environment:
ENV: DEV
volumes:
- ./app:/app
When I run
docker-compose up -d
it shows
Starting identidock_identidock_1 ... done
But if I check images
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
identidock_identidock latest b5003205377f 12 days ago 698MB
identidock latest 8eafce868d95 12 days ago 698MB
<none> <none> de77d0555129 13 days ago 698MB
<none> <none> 2f8bfc8f0a95 13 days ago 697MB
<none> <none> a42d37d82f28 2 weeks ago 535MB
<none> <none> 592d8c832533 2 weeks ago 695MB
python 3.4 41f9e544ec6c 2 weeks ago 684MB
It is obvious that new image has not been created.If I to http://localhost:5000/,
I got
Firefox can’t establish a connection to the server at localhost:5000.
This is docker ps -a output
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0414117eadd8 identidock_identidock "/cmd.sh" 12 days ago Exited (255) 11 days ago 9090/tcp, 0.0.0.0:5000->5000/tcp, 9191/tcp blissful_easley
4146fd976547 identidock_identidock:latest "/cmd.sh" 12 days ago Exited (255) 11 days ago 9090/tcp, 9191/tcp agitated_leakey
15d49655b290 identidock_identidock "/cmd.sh" 12 days ago Exited (1) 23 minutes ago identidock_identidock_1
And
docker-compose ps
Name Command State Ports
--------------------------------------------------
identidock_identidock_1 /cmd.sh Exit 1
Why?
The container may not have started. Check docker-compose ps. If the containers listed are not in Up state, then you can use docker-compose logs identidock to view the logs.

deleting old images in Docker - OSX

I've been toying with a docker image for Tensorflow.
To summarize, I first installed the standard image, then realized I needed nodejs, so added it and did a docker commit. Then realized I needed expressJS, added it an did a commit
I am running docker v1.12.5 (so the new gc/prune commands are not there)
At this stage, docker images -a shows:
REPOSITORY TAG IMAGE ID CREATED SIZE
tensor-node-express latest f2f59eb61aae 15 hours ago 2.104 GB
gcr.io/tensorflow/tensorflow latest-devel 308238445d5c 2 days ago 1.995 GB
gcr.io/tensorflow/tensorflow <none> 74435614a991 9 days ago 1.52 GB
I only want to keep tensor-node-express and delete the older images.
$ docker rmi 308238445d5c
Error response from daemon: conflict: unable to delete 308238445d5c (cannot be forced) - image has dependent child images
$docker rmi gcr.io/tensorflow/tensorflow:latest-devel
Error response from daemon: conflict: unable to remove repository reference "gcr.io/tensorflow/tensorflow:latest-devel" (must force) - container 03de9d864e31 is using its referenced image 308238445d5c
I assumed that this means docker commits store differential images, but when I go to ~/.docker/machine/machines/default, I see:
40894464 Mar 13 13:57 boot2docker.iso
5043847168 Mar 16 08:34 disk.vmdk
I suppose the 5G file is a composite of my images, which seems to show each docker commit is the full image!
Any thoughts on how I can only use the latest docker image (tensor-node-express) and free my HD of the invasion of docker?
Supplementary info - here is the output of docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6dcd2915991 tensor-node-express "/bin/bash" 15 hours ago Exited (130) 15 hours ago flamboyant_bose
fb44b19a21c2 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 18 hours ago Exited (130) 15 hours ago compassionate_bose
075001a687e3 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 18 hours ago Exited (0) 18 hours ago nervous_sinoussi
a80ce2d2e688 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 19 hours ago Exited (130) 18 hours ago happy_euclid
f493bd3c8712 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 19 hours ago Exited (1) 19 hours ago friendly_cori
03de9d864e31 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (255) 23 minutes ago 6006/tcp, 8888/tcp tender_hopper
2dd1e83d62d3 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (0) 15 hours ago modest_einstein
3067ed171b1c gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (0) 2 days ago dazzling_bhabha
62c699afd3fd 74435614a991 "/bin/bash" 2 days ago Exited (127) 2 days ago inspiring_austin
9523ffe2945c 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago kickass_leakey
e06958ea517c 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago objective_euler
ccf922954667 74435614a991 "/bin/bash" 2 days ago Exited (255) 2 days ago dreamy_bartik
fad0d92a07a3 74435614a991 "/bin/bash" 2 days ago Exited (130) 2 days ago elastic_dubinsky
f2a98d4e11ea 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago heuristic_kilby
f07e46367b17 74435614a991 "/bin/bash" 2 days ago Exited (130) 2 days ago trusting_darwin
5bbf9cf992b8 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago flamboyant_knuth
I tried
docker ps --filter "status=exited" | grep "days ago" | awk '{print $1}' | xargs docker rm (credit)
I ran the above manually as well for some of the containers it missed
That pruned the ps list to:
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6dcd2915991 tensor-node-express "/bin/bash" 15 hours ago Exited (130) 15 hours ago flamboyant_bose
But even then I can't delete old images - same error.
Further update, I tried to list dependencies in images (credit)
using this script:
for i in $(docker images -q)
do
docker history $i | grep -q 74435614a991 && echo $i
done | sort -u
And it told me:
308238445d5c
74435614a991
f2f59eb61aae
This means my new images are child images of the old image. But the size is not a differential looking at the disk size.
Thoughts?
docker-machine uses a Linux VM
When you looked at the docker-machine .vdmk and .iso files, what you are looking at is files for a Linux VM running on your Mac. This is needed because Docker requires Linux kernel features to run, it cannot run directly on the Mac's microkernel.
So your Mac is running a Linux virtual machine, and inside that virutal machine is running the Docker daemon and all of your containers.
Therefore the file size of the .vmdk and .iso tell you nothing about any one image.
docker images have parent/child relationships
As you may already know, docker images have parents and/or children. For instance when you build an image with a Dockerfile like this:
FROM ubuntu:latest
RUN apt-get update && apt-get install nginx
You will end up with a new image that you have perhaps tagged my-nginx. But it requires the ubuntu:latest image as its parent; you cannot delete ubuntu:latest with this image still around, as it requires its parent.
docker commit creates those relationships
When you use docker commit, you are basically doing a dynamic snapshot build. It is similar to the above, except there's no Dockerfile involved.
The above example has a FROM line which indicates the image to use as a base. When using commit, there is a base implied - whatever image was used to launch the running container that you are committing.
The above example has a RUN command which will create new contents in the built image, above and beyond the base image. In a real Dockerfile there are usually multiple commands that do various things which build on the base image. When you use commit, you don't have that. Instead, anything that has been written to the container on top of the base image is your new content. It exists in a read-write filesystem layer in the container. That is the thing you are committing; it is written as a new read-only layer and you get that back as a new (immutable, read-only) docker image. With a parent.
Based on your comments, and the question itself, you appear to have believed that using docker commit would create a new full image that had no dependencies on other images. That is not true. You can craft images like that if you build them yourself from scratch, just not this way.
You can untag the image
If what you want is for the image to not show up in your list, that's easy. Just untag it.
docker rmi gcr.io/tensorflow/tensorflow:latest-devel
However, this is more or less cosmetic. The image will still be there, as another image requires it. All this does is remove the tag, so it doesn't appear in the docker images list anymore without the -a flag.
The reason trying this did not work for you is you tried to rmi the image using its ID, not using its tag.

Docker eating up disk space /var/lib/docker/devicemapper/devicemapper

We are using Docker and have a production issue. We are running out of space in our root volume since docker device mapper is eating up space.
Is there a way to reduce the disk space to a proper size without having to remove Docker and reinstall from scratch?
The docker version we are using is
Client:
Version: 1.8.2
API version: 1.20
Go version: go1.4.2
Git commit: 0a8c2e3
Built: Thu Sep 10 19:08:45 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.8.2
API version: 1.20
Go version: go1.4.2
Git commit: 0a8c2e3
Built: Thu Sep 10 19:08:45 UTC 2015
OS/Arch: linux/amd64
We have 20 GB root volume and 12GB is used by docker. We are left with only few GB of space. The below docker file is 12GB
/var/lib/docker/devicemapper/devicemapper/data
We have also tried removing unused old docker images by using the command
docker images -q |xargs docker rmi
but still it doesn't work.
Appreciate if someone could let me know if there is any way to reduce the disk space to a proper size WITHOUT having to remove docker and reinstall from scratch? Also we don't want to copy files to a new location and do a softlink.
The current docker command outputs are
[root#ip-10-202-69-58 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
92558da1291a dockyardaws.kdc.capitalone.com/statim/plexus:27.6 "/root/go/src/plexus/" 19 hours ago Up 19 hours quality
2a0497fdbaa7 dockyardaws.kdc.capitalone.com/statim/plexus:21.9 "/root/go/src/plexus/" 21 hours ago Up 21 hours rmCallMetrics
1f5f93604e8f dockyardaws.kdc.capitalone.com/statim/loanservicing:8.3 "/root/go/src/loanser" 2 days ago Up 2 days ls_vznagtingestor
88b4d764c03c dockyardaws.kdc.capitalone.com/statim/plexus:21.3 "/root/go/src/plexus/" 3 days ago Up 3 days dlrMgmt
bd0ecfe2f9ae dockyardaws.kdc.capitalone.com/statim/plexus:12.1 "/root/go/src/plexus/" 3 days ago Up 3 days userRMAttributesIngestor
8bd3d626f7d7 dockyardaws.kdc.capitalone.com/statim/plexus:12.1 "/root/go/src/plexus/" 3 days ago Up 3 days dhPointsPerHour
383e257d2f31 dockyardaws.kdc.capitalone.com/statim/plexus:12.1 "/root/go/src/plexus/" 3 days ago Up 3 days dhPrimeSameDayContracts
6727c76221e4 dockyardaws.kdc.capitalone.com/statim/plexus:12.1 "/root/go/src/plexus/" 3 days ago Up 3 days rbcARMAgentsIngestor
527327182f0a dockyardaws.kdc.capitalone.com/statim/plexus:19.6 "/root/go/src/plexus/" 3 days ago Up 3 days dhDealerOrg
1ece1b0f61a7 dockyardaws.kdc.capitalone.com/statim/plexus:25.6 "/root/go/src/plexus/" 3 days ago Up 3 days shawMasterFileLvl1
8aefc887e1f5 dockyardaws.kdc.capitalone.com/statim/plexus:12.1 "/root/go/src/plexus/" 3 days ago Up 3 days dhExhaustEveryEffort
94b89a019b8c dockyardaws.kdc.capitalone.com/statim/plexus:22.1 "/root/go/src/plexus/" 3 days ago Up 3 days asmSummaryWeeklyMetrics
e64e9fe9c7e2 dockyardaws.kdc.capitalone.com/statim/plexus:12.1 "/root/go/src/plexus/" 3 days ago Up 3 days dhForecastedMetrics
f39c5fef33d3 dockyardaws.kdc.capitalone.com/statim/plexus:12.1 "/root/go/src/plexus/" 3 days ago Up 3 days dhMTDContracts
[root#ip-10-202-69-58 ~]#
[root#ip-10-202-69-58 ~]#
[root#ip-10-202-69-58 ~]# docker ps -qa
92558da1291a
2a0497fdbaa7
1f5f93604e8f
88b4d764c03c
bd0ecfe2f9ae
8bd3d626f7d7
383e257d2f31
6727c76221e4
527327182f0a
1ece1b0f61a7
8aefc887e1f5
94b89a019b8c
e64e9fe9c7e2
f39c5fef33d3
[root#ip-10-202-69-58 ~]#
[root#ip-10-202-69-58 ~]#
[root#ip-10-202-69-58 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
dockyardaws.kdc.capitalone.com/statim/plexus 27.6 75fd00165ca4 19 hours ago 976.7 MB
dockyardaws.kdc.capitalone.com/statim/loanservicing 8.3 84bf8f83af5b 2 days ago 973.4 MB
dockyardaws.kdc.capitalone.com/statim/plexus 25.6 672f56435428 13 days ago 976.9 MB
dockyardaws.kdc.capitalone.com/statim/plexus 22.1 3f0d00cf334a 3 weeks ago 976.4 MB
dockyardaws.kdc.capitalone.com/statim/plexus 21.9 783a4e812972 3 weeks ago 976.4 MB
dockyardaws.kdc.capitalone.com/statim/plexus 21.3 28a70e5a5621 3 weeks ago 976.3 MB
dockyardaws.kdc.capitalone.com/statim/plexus 19.6 b85f1fd3e822 4 weeks ago 975.4 MB
dockyardaws.kdc.capitalone.com/statim/plexus 12.1 ce572ad85088 9 weeks ago 971.8 MB
[root#ip-10-202-69-58 ~]#
[root#ip-10-202-69-58 ~]#
[root#ip-10-202-69-58 ~]# docker images -q
75fd00165ca4
84bf8f83af5b
672f56435428
3f0d00cf334a
783a4e812972
28a70e5a5621
b85f1fd3e822
ce572ad85088
[root#ip-10-202-69-58 ~]#
Try removing docker containers which are not running:
docker rm -v $(docker ps -a -q -f status=exited)
And then remove the unused docker images:
docker rmi $(docker images -q)

Resources