Docker diff images - docker

I know the question has already been asked (a long time ago), but I cannot find any answer, so I ask it one more time: I have a "complex" (ie deep) tree of docker images locally, and I would like to see the difference between images.
[lgmasapp203 ~]$ docker images -t
Warning: '-t' is deprecated, it will be removed soon. See usage.
├─64e5325c0d9d Virtual Size: 125.1 MB
│ └─bf84c1d84a8f Virtual Size: 125.1 MB
│ └─87de57de6955 Virtual Size: 169.5 MB
│ └─6a974bea7c0d Virtual Size: 291.8 MB
│ └─06c293acac6e Virtual Size: 292.6 MB
│ └─b8a058108e9e Virtual Size: 292.6 MB
│ └─9aa09af53eee Virtual Size: 292.6 MB
│ └─a0513c939a75 Virtual Size: 292.6 MB
│ └─f509350ab0be Virtual Size: 292.6 MB
│ └─b0b7b9978dda Virtual Size: 292.6 MB
│ └─6a0b67c37920 Virtual Size: 815.9 MB
I already tried docker save <image-id> method, then extract the tar file and compare the entries, but what I get is only a bunch of json, VERSION and layer.tar files:
[lgmasapp203 ~]$ find 226a
226a
226a/9aa09af53eeee5a36dfd4f0542cf61ec16c3c168e3b6303b49a7bd5b804b1f56
226a/9aa09af53eeee5a36dfd4f0542cf61ec16c3c168e3b6303b49a7bd5b804b1f56/json
226a/9aa09af53eeee5a36dfd4f0542cf61ec16c3c168e3b6303b49a7bd5b804b1f56/VERSION
226a/9aa09af53eeee5a36dfd4f0542cf61ec16c3c168e3b6303b49a7bd5b804b1f56/layer.tar
226a/e617952427002a05bebf16ba89b0bcaf93a91c786171a6bebedae828ccce7c48
226a/e617952427002a05bebf16ba89b0bcaf93a91c786171a6bebedae828ccce7c48/json
226a/e617952427002a05bebf16ba89b0bcaf93a91c786171a6bebedae828ccce7c48/VERSION
226a/e617952427002a05bebf16ba89b0bcaf93a91c786171a6bebedae828ccce7c48/layer.tar
226a/dddd9e457da7e4ad86d2f6323541bfd439cf290716416a40a9fb4944ecee5c87
226a/dddd9e457da7e4ad86d2f6323541bfd439cf290716416a40a9fb4944ecee5c87/json
226a/dddd9e457da7e4ad86d2f6323541bfd439cf290716416a40a9fb4944ecee5c87/VERSION 226a/dddd9e457da7e4ad86d2f6323541bfd439cf290716416a40a9fb4944ecee5c87/layer.tar
I also tried to take a look directly into /var/lib/docker directory, but did not find anything.
So I started back from "scratch", with a very simple example:
[lgmasapp203 ~]$ docker run centos touch xxx
[lgmasapp203 ~]$ docker ps -n 1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b43b9b84172f centos:7 "touch xxx" 7 seconds ago Exited (0) 5 seconds ago backstabbing_hoover
[lgmasapp203 ~]$ docker commit b43b xxx
4b0ed5d4fd1a09e062a02b7066b83115d73a1811863c597f6c5bda01a90507f4
[lgmasapp203 ~]$ docker run xxx ls -l xxx
-rw-r--r-- 1 root root 0 Jul 2 14:31 xxx
Everything looks fine, but:
[lgmasapp203 docker]# find /var/lib/docker/graph/4b0ed5d4fd1a09e062a02b7066b83115d73a1811863c597f6c5bda01a90507f4/
/var/lib/docker/graph/4b0ed5d4fd1a09e062a02b7066b83115d73a1811863c597f6c5bda01a90507f4/
/var/lib/docker/graph/4b0ed5d4fd1a09e062a02b7066b83115d73a1811863c597f6c5bda01a90507f4/layersize
/var/lib/docker/graph/4b0ed5d4fd1a09e062a02b7066b83115d73a1811863c597f6c5bda01a90507f4/json
An I did not find anything related to "layer" (as mentionned here). I do not understand why?
Furthermore:
[lgmasapp203 docker]# find /var/lib/docker/ | grep xxx
[lgmasapp203 docker]#
So where did my file xxx go?
It appears to me that this would be a "basic" feature... and then I'm surprised this has not been addressed already...
Does that mean that I have to rely on the "comment" section of the json??? That would be seriously astonishing :-/
I know that is a lot of questions ;-)
Thanxs in advance for any enlightment
Christophe

I think you didn't find your file with a find because of filesystem rights.
If you look in /var/lib/docker/aufs/diff/4b0ed5d4fd1a09e062a02b7066b83115d73a1811863c597f6c5bda01a90507f4 you might find your xxx file.

Related

Where does Prometheus store metrics data (in container)?

I am searching for the ./data folder described in Storage section pf Prometheus Documentation.
I run a basic Prometheus Docker container prom/prometheus on Kubernetes. If I execute a shell inside the container, the working directory is /prometheus and it contains the wal directory, but it does not have the structure mentioned in the documentation and I can not find any metric data.
Where are the metrics stored which I can query over Prometheus GUI?
As you can check the Prometheus Dockerfile on Github (https://github.com/prometheus/prometheus/blob/master/Dockerfile#L24), the working directory is /prometheus and that where you will find all the metrics and data.
Below is the data present in /prometheus directory
/prometheus $ ls -l
total 8
-rw-r--r-- 1 nobody nogroup 0 May 28 12:39 lock
-rw-r--r-- 1 nobody nogroup 20001 May 28 12:45 queries.active
drwxr-xr-x 2 nobody nogroup 4096 May 28 12:39 wal
And this is the *Time Series Database * which you can't decode . If you will run more exporters, probably you can see more folders like chunks etc.
Ref: https://prometheus.io/docs/prometheus/1.8/storage/
I have figured out the problem now. The structure, which was mentioned in the documentation, need several hours to build up.
./data
├── 01BKGTZQ1HHWHV8FBJXW1Y3W0K
│ └── meta.json
├── 01BKGV7JC0RY8A6MACW02A2PJD
│ ├── chunks
│ │ └── 000001
│ ├── tombstones
│ ├── index
│ └── meta.json
└── wal
├── 00000002
└── checkpoint.000001
The first of those folders starting with 01... appeared after 4 hours. The next one took an other 2 hours. It seems to vary according to the amount of metrics you are pulling.
Sidenote: As nischay goyal wrote in his answer, Prometheus TSDB can not be decoded. You can query the Prometheus API with a script to export metrics.

Docker Containers all gone after reboot

I had changed the directory to store containers and images as /data/docker.And it work successfully in the coming one year.
However, after I reboot the system (Ubuntu 16.04), a disk partition /dev/sdb4 was broken,which was mount to /data/docker. And the broken partition lead to the system come into emergency mode. I run a command fsck -y /dev/sdb4 to repair it and restart again.
After restarting,all work normally as before except docker. It is amazing that all my container and almost images were missing. When I run docker container ls -a,I got nothing. When I run docker images,I only got one list mysql 5.6 7edb93321b06 5 months ago 256MB.But I had 4 containers and some (more than one) images before. In other words,they were gone after reboot.
In addition,when I run sudo du -h /data/docker/volumes,I got:
6.8M /data/docker/volumes/b35a0a2be6a1d10693e891f0b5c7dfa6e27a34b6a61384e6db79ac06df4bde36/_data/mysql
636K /data/docker/volumes/b35a0a2be6a1d10693e891f0b5c7dfa6e27a34b6a61384e6db79ac06df4bde36/_data/performance_schema
116M /data/docker/volumes/b35a0a2be6a1d10693e891f0b5c7dfa6e27a34b6a61384e6db79ac06df4bde36/_data
116M /data/docker/volumes/b35a0a2be6a1d10693e891f0b5c7dfa6e27a34b6a61384e6db79ac06df4bde36
4.0K /data/docker/volumes/4bfb7ca010e869edd409ee14aa3a8b9ec70ec144a1b1586e792a8f87f9d5a9b2/_data
8.0K /data/docker/volumes/4bfb7ca010e869edd409ee14aa3a8b9ec70ec144a1b1586e792a8f87f9d5a9b2
4.0K /data/docker/volumes/d24ddf0126cef08bc3ff8bf75e79e76375b1e6cfa70c646d3173554d78555aeb/_data
8.0K /data/docker/volumes/d24ddf0126cef08bc3ff8bf75e79e76375b1e6cfa70c646d3173554d78555aeb
4.0K /data/docker/volumes/c22f29c1ab50c2973e6e1cc3e1ea64ad7a253741d44a290df3789fbf1e4c3a05/_data
8.0K /data/docker/volumes/c22f29c1ab50c2973e6e1cc3e1ea64ad7a253741d44a290df3789fbf1e4c3a05
4.0K /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/#innodb_temp
84K /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/sys
32K /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/mysql
84K /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/test
1.4M /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data/performance_schema
165M /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3/_data
165M /data/docker/volumes/985f51b406657eacbd70dfe7d0bd0502287c783a389ae34fa36d70b5c98e94a3
3.1G /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data/newProject
6.8M /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data/mysql
387M /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data/project
636K /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data/performance_schema
4.0G /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5/_data
4.0G /data/docker/volumes/b445468b292cff4531429b7a9883a825fc794327a46672ec518e7765050437e5
4.2G /data/docker/volumes
It means that some of data is not lost.
How can I repair it and find them back ?

kubernetes not able to pull image from spark master host

I have 3 node[host a,host b, host c] kubernetes cluster(version 1.12.2). I am trying run spark-pi example jar as mentioned in kubernetes document.
Host a is my kubernetes Master. >> kubectl get nodees list all the three nodes.
I have built the spark docker image using whats provided in spark 2.3.0 binary folder.
>> sudo ./bin/docker-image-tool.sh -r docker.io/spark/spark -t spark230 build
I got the message the image got built successfully.
>> docker images ls
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/spark/spark spark230 6a2b645d7efe About an hour ago 346 MB
docker.io/weaveworks/weave-npc 2.5.0 d499500e93d3 7 days ago 49.5 MB
docker.io/weaveworks/weave-kube 2.5.0 a5103f96993a 7 days ago 148 MB
docker.io/openjdk 8-alpine 97bc1352afde 2 weeks ago 103 MB
k8s.gcr.io/kube-proxy v1.12.2 15e9da1ca195 2 weeks ago 96.5 MB
k8s.gcr.io/kube-apiserver v1.12.2 51a9c329b7c5 2 weeks ago 194 MB
k8s.gcr.io/kube-controller-manager v1.12.2 15548c720a70 2 weeks ago 164 MB
k8s.gcr.io/kube-scheduler v1.12.2 d6d57c76136c 2 weeks ago 58.3 MB
k8s.gcr.io/etcd 3.2.24 3cab8e1b9802 7 weeks ago 220 MB
k8s.gcr.io/coredns 1.2.2 367cdc8433a4 2 months ago 39.2 MB
k8s.gcr.io/pause 3.1 da86e6ba6ca1 10 months ago 742 kB
> ./bin/spark-submit
--master k8s://https://<api-server>:<api
> server port> --deploy-mode cluster --name spark-pi
> --class org.apache.spark.examples.SparkPi --conf spark.executor.instances=5 --conf
> spark.kubernetes.container.image=spark/spark:spark230 --conf
> spark.kubernetes.authenticate.driver.serviceAccountName=spark
> local:///opt/spark/examples/jars/spark-examples_2.11-2.3.0.jar
When I submit above command , it gives proper output sometimes. Other times it throws below error.
> code = Unknown desc = repository docker.io/spark/spark not found:
does not exist or no pull access, reason=ErrImagePull
When I debugged it further, it looks like, whenever node name: host b or host c its throwing above error message.
When node name : host a , then it runs fine. Looks like other nodes are unable to locate the image.
Questions:
Should I install spark on all nodes & build docker image on all nodes?
Is it possible to pass the image reference from single node [host a] to other nodes? i.e how to make other nodes refer the same image from host a.
Yes, you need to build Spark image in all the nodes. You can write the wrapper script to invoke the 'rebuild-image.sh' on all the nodes as below:
for h in hostnames; do
rsync -av /opt/spark ${h}:/opt
ssh ${h} /opt/spark/rebuild-image.sh
You can always save docker image as tar file and then copy that tar file to other host and load the image there.
To save docker image as tar file:
sudo docker save -o <path for generated tar file> <image name>
Now copy your tar file to other host using scp or some other copy tools. And load the docker image using:
sudo docker load -i <path to image tar file>
Hope this helps

Listing all version numbers of docker image

How can I list the tag history of an image?
'docker search ' command lists only the matching images in the registry, not the version (tags). I wanted to know the tag history of the given image.
One way to know this detail is to go to Docker Hub or GitHub folders for the image and deduce previous versions from Dockerfile.
Is it possible to get this info from docker client command line?
I assume you want to see the list of tagged commits on the image, you can use Dockviz to do that:
$ dockviz images -t
...
├─<missing> Virtual Size: 122.0 MB
│ └─<missing> Virtual Size: 122.4 MB
│ └─<missing> Virtual Size: 122.4 MB
│ └─<missing> Virtual Size: 122.4 MB
│ └─sha256:12543 Virtual Size: 122.4 MB Tags: ubuntu:latest
│ ├─sha256:e807b Virtual Size: 198.1 MB Tags: test/ubuntu:commit2
│ └─sha256:dafd9 Virtual Size: 189.8 MB Tags: test/ubuntu:commit1

Docker disk usage

I am hosting some simple docker containers. I am wondering that the container size is increasing over time quickly and I do not know how to figure out the problem.
Size reported by Docker:
me#somewhere:~$ sudo docker ps -s
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
02b30add1cb3 my-service "npm start" 23 hours ago Up 23 hours 3001/tcp, 0.0.0.0:9017->9017/tcp my-service-frontend 0 B (virtual 776.4 MB)
20a2be4931e7 my-service "phantomjs src/sites/" 23 hours ago Up 23 hours 0.0.0.0:3007->3001/tcp my-service-5 6.144 kB (virtual 776.4 MB)
ba340ba08941 my-service "phantomjs src/sites/" 23 hours ago Up 23 hours 0.0.0.0:3006->3001/tcp my-service-4 6.144 kB (virtual 776.4 MB)
7b5411d8a171 my-service "phantomjs src/sites/" 23 hours ago Up 23 hours 0.0.0.0:3003->3001/tcp my-service-1 6.144 kB (virtual 776.4 MB)
b583a544b37d my-service "phantomjs src/sites/" 23 hours ago Up 23 hours 0.0.0.0:3001->3001/tcp my-service-0 6.144 kB (virtual 776.4 MB)
91373086e06e foo_bar "/bin/sh -c 'git pull" 47 hours ago Up 47 hours 0.0.0.0:12776->8080/tcp kickass_murdock 11.26 MB (virtual 1.081 GB)
Size reported by du on host:
me#somewhere:~$ sudo du -h -d 1 /var/lib/docker/containers
14G /var/lib/docker/containers/20a2be4931e7a10b2e29260b541e3c4d6581462650e47d59682f84626843752b
1,6G /var/lib/docker/containers/7b5411d8a171a35a3c937d62dbdea141fc0a9f3c4de25a2da3a0b94ea71a8f3d
9,6M /var/lib/docker/containers/02b30add1cb3ba6d5be1c36b2c9dd141d8d70cb88a021d2363af5684ef3c220f
480K /var/lib/docker/containers/91373086e06ea83269465e0b026cfe7ca0158a1315b0df04da9a1d1b4ee52823
13G /var/lib/docker/containers/b583a544b37db6144f17a4819ca2f636126b11d668caab3dcdbf4c3a33dedc65
13G /var/lib/docker/containers/ba340ba08941d47af45230be328ef7289c19b6bb6a0d120cf2098cbdd9983f65
40G /var/lib/docker/containers`
Size reported by du for a container (similar output for all other containers):
me#somewhere:~$ sudo docker exec -it my-service-4 du -h -d1 -c /
58M /root
0 /dev
3.0M /etc
706M /usr
1.4M /tmp
14M /var
9.0M /bin
32M /lib
4.0K /home
8.0K /run
4.0K /mnt
4.0K /boot
0 /sys
4.0K /opt
4.0K /srv
4.0K /lib64
3.9M /sbin
du: cannot access '/proc/12642/task/12642/fd/3': No such file or directory
du: cannot access '/proc/12642/task/12642/fdinfo/3': No such file or directory
du: cannot access '/proc/12642/fd/3': No such file or directory
du: cannot access '/proc/12642/fdinfo/3': No such file or directory
0 /proc
4.0K /media
825M /
825M total
So: Both the container and docker ps report disk usage below 1G, though the actual container file size is more than 10 GB (at least for some). Can any body help me and tell what is happening? I guess there is some trouble going on within my container, though I do not know where to look right now. Anybody knows what I have to do?
Docker put one layer over the other in its onion file system whenever changes are stored to an image. When you delete your container docker rmi -f CONTAINERID, you should see that /var/lib/docker/containers uses less space.
Changes to an image are stored when you build it. If you just use an image - run a container - the changed data is just "hold". So you should investigate what happens IN your container. Esp. see what your phantom server produces in the filesystem. ncdu would be a good tool for that.
Start with ncdu and then store the files that are produced in an attached folder of your hosts filesystem. docker run -it -v FULLPATHATHOST:FULLPATHWITHINCONTAINER CONTAINERID
Test
run a simple container, containing nothing more than the os (in my case alpine)
docker run -it stk/alpine:base sh
At the host go to /var/lib/docker/aufs/diff/ and list the containing directories with ncdu. (Of course you can use any other program you like to determine the diretories sizes)
ncdu 1.10 ~ Use the arrow keys to navigate, press ? for help
--- /var/lib/docker/aufs/diff --------------------------------------------------
/..
286,4MiB [##########] /39f3e2ea0dfe17366b8cd7b0...bf3681b99a1081e33ad62a509f28
214,3MiB [####### ] /2de39307b9361cae12f0116e...d28056e4699b21b9a4d34f374461
207,7MiB [####### ] /92ec6d044cb3e39ae0050012...78d0591675f2231daafbf0877778
154,0MiB [##### ] /9f3806e6bedc8fb01929131b...e01aa1980aadba914fdd9d2f96ae
149,5MiB [##### ] /5f0ca2331640639507d85b83...693659438367311abb0c792b8a62
136,8MiB [#### ] /902b87aaaec929e805414868...1f529ad7f37ab300d4ef9f3a0dbf
136,2MiB [#### ] /222ba86561913d299deb9e0e...6b5f5ec117b01386a4156d092687
132,6MiB [#### ] /8b3a9a9eeaf8ed59f24f21a2...dfe8d033890a2fa44b445deb2e3c
128,5MiB [#### ] /72b3edf317a8d682466c1500...a5e2cad31c8305ed42c41cd61149
117,0MiB [#### ] /818e3763e72ef82b28b0552e...b9f163dc601d266e94e46fd26bb0
57,4MiB [## ] /eeffdfafed9f60771b5bf87a...e8bbd16b572f77899c8e689d174d
56,1MiB [# ] /6976ce3ed5fab37382d90467...37578332417ffcf35a1d499eba52
51,3MiB [# ] /a5a6e0549d247f1c8b81a350...c5071f46d17afe2f8988817360b3
Total disk usage: 2,7GiB Apparent size: 2,7GiB Items: 168658
Within the container execute something like
tr -dc A-Za-z0-9 </dev/urandom | head -c 409600000 > a.txt && ls a.txt -all -h
that will create a file with random data called a.txt I choosed the size 409600000 to be greater than 286,4MiB - the largest folder in /var/lib/docker/aufs/diff/ - so that ncdu shall show it on top
ncdu 1.10 ~ Use the arrow keys to navigate, press ? for help
--- /var/lib/docker/aufs/diff --------------------------------------------------
/..
390,6MiB [##########] /0720a07653a57d938c861cf3...e61c81c29f12289759f0560aa38f
286,4MiB [####### ] /39f3e2ea0dfe17366b8cd7b0...bf3681b99a1081e33ad62a509f28
214,3MiB [##### ] /2de39307b9361cae12f0116e...d28056e4699b21b9a4d34f374461
207,7MiB [##### ] /92ec6d044cb3e39ae0050012...78d0591675f2231daafbf0877778
154,0MiB [### ] /9f3806e6bedc8fb01929131b...e01aa1980aadba914fdd9d2f96ae
149,5MiB [### ] /5f0ca2331640639507d85b83...693659438367311abb0c792b8a62
136,8MiB [### ] /902b87aaaec929e805414868...1f529ad7f37ab300d4ef9f3a0dbf
136,2MiB [### ] /222ba86561913d299deb9e0e...6b5f5ec117b01386a4156d092687
132,6MiB [### ] /8b3a9a9eeaf8ed59f24f21a2...dfe8d033890a2fa44b445deb2e3c
128,5MiB [### ] /72b3edf317a8d682466c1500...a5e2cad31c8305ed42c41cd61149
117,0MiB [## ] /818e3763e72ef82b28b0552e...b9f163dc601d266e94e46fd26bb0
57,4MiB [# ] /eeffdfafed9f60771b5bf87a...e8bbd16b572f77899c8e689d174d
56,1MiB [# ] /6976ce3ed5fab37382d90467...37578332417ffcf35a1d499eba52
Total disk usage: 3,0GiB Apparent size: 3,0GiB Items: 168678
Now I know that it's the directory starting with 0720a07653a57d9... is that I have to look for. Go into it and list the content
root#T520:/var/lib/docker/aufs/diff# cd 0720a07653a57d938c861cf32f4bee87fa4be61c81c29f12289759f0560aa38f
root#T520:/var/lib/docker/aufs/diff/0720a07653a57d938c861cf32f4bee87fa4be61c81c29f12289759f0560aa38f# ls -all -h
insgesamt 391M
drwxr-xr-x 5 root root 4,0K Feb 23 10:55 .
drwxr-xr-x 674 root root 80K Feb 23 10:55 ..
-rw-r--r-- 1 root root 391M Feb 23 10:57 a.txt
drwx------ 2 root root 4,0K Feb 23 10:55 root
-r--r--r-- 1 root root 0 Feb 23 10:55 .wh..wh.aufs
drwx------ 2 root root 4,0K Feb 23 10:55 .wh..wh.orph
drwx------ 2 root root 4,0K Feb 23 10:55 .wh..wh.plnk
As you can see, there is the file a.txt listed.
Now rerun the procedure, random file creation and relist ncdu (just hit r in ncdu.)
ncdu should show you, as well as ls should do, that the directory size did not change. So the data within the docker fs is just overwritten. If you choose a smale size it gets smaller.
So how might this help you?
As I showed above there is no file growth for changing data within files. And you can find out witch directory contains you filesystem and see the plain filestructure of added/changed files within your container.
Hope this helps to find the files within your container.
If you exit your container and restart it by the same command again, a new instance is created, with it own fs layer is created.
You can find the ids of your stopped containers use
docker ps -a | grep Exited | grep stk/alpine:base | awk '{print $1 }'
To see what is found before deleteing...
docker ps -a | grep Exited | grep stk/alpine:base
7b7d3f6e857a stk/alpine:base "sh" 22 minutes ago Exited (0) 2 minutes ago gigantic_swartz
2f51ea988a28 stk/alpine:base "sh" 23 minutes ago Exited (0) 22 minutes ago cranky_euler
4bfafbb034fe stk/alpine:base "sh" 34 minutes ago Exited (0) 25 minutes ago sick_williams
80cd5687fcd7 stk/alpine:base "sh" 44 minutes ago Exited (137) 37 minutes ago determined_panini
a2179a8dd543 stk/alpine:base "sh" 58 minutes ago Exited (130) 44 minutes ago agitated_shockley
8596cd310292 stk/alpine:base "sh" 3 days ago Exited (137) 3 days ago dreamy_murdock
33db61a7830b stk/alpine:base "sh" 3 days ago Exited (0) 3 days ago desperate_hodgkin
2f96c15dc8a1 stk/alpine:base "sh" 2 weeks ago Exited (0) 2 weeks ago determined_babbage
Attach | xargs -r docker rm to delete them
One line solution
docker ps -a | grep Exited | grep stk/alpine:base | awk '{print $1 }' | xargs -r docker rm
Docker will check that the images are not used by other images and complain if it can't be removed if you do docker rmi. But in this case you want the containers and not the images to be deleted. So use rm instead of rmi (I updated the answer)
Enjoy

Resources