Skip to content

Commit 5c5f21a

Browse files
author
Hai Chang
committed
Update the clean image docker to support containerd
1 parent a91615a commit 5c5f21a

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
FROM docker
1+
FROM ubuntu
22

3-
ADD cleanup /etc/periodic/hourly
3+
RUN apt-get update && apt-get install cron -y && apt-get install wget -y
4+
RUN wget https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.23.0/crictl-v1.23.0-linux-amd64.tar.gz && tar zxvf crictl-v1.23.0-linux-amd64.tar.gz -C /usr/local/bin
5+
RUN rm -f crictl-v1.23.0-linux-amd64.tar.gz
6+
7+
ADD cleanup /etc/cron.hourly
48

59
CMD [ "/bin/sh", "-c", "crond -f"]

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To prevent this problem I created this small docker utility.
1212
The following commands will be triggered on startup of the container.
1313

1414
```sh
15-
docker system prune -af
15+
crictl rmi --prune
1616
```
1717

1818
## Usage
@@ -33,12 +33,12 @@ spec:
3333
stdinOnce: true
3434
tty: true
3535
volumeMounts:
36-
- mountPath: /var/run/docker.sock
37-
name: dockersock
36+
- mountPath: /var/run/containerd/containerd.sock
37+
name: containerdsock
3838
readOnly: true
3939
volumes:
40-
- name: dockersock
40+
- name: containerdsock
4141
hostPath:
42-
path: /var/run/docker.sock
42+
path: /var/run/containerd/containerd.sock
4343
EOF
4444
```

cleanup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22

33
echo 'Clean all:' `date` | tee -a /var/log/imagecleaner.log
4-
docker system prune -af | tee -a /var/log/imagecleaner.log
4+
crictl rmi --prune | tee -a /var/log/imagecleaner.log

0 commit comments

Comments
 (0)