Commit d54701e6 authored by nimrod's avatar nimrod
Browse files

Periodic garbage collection.

- Add a crond image.
- Add a weekly Cron job to run garbage collection.
parent dc21f082
Loading
Loading
Loading
Loading
Loading

crond/.dockerignore

0 → 100644
+2 −0
Original line number Diff line number Diff line
*
!crontab

crond/Dockerfile

0 → 100644
+6 −0
Original line number Diff line number Diff line
# hadolint ignore=DL3006
FROM registry.shore.co.il/cron as supersonic
# hadolint ignore=DL3002
USER root
# hadolint ignore=DL3018
RUN apk add --update --no-cache docker-cli

crond/README.md

0 → 100644
+20 −0
Original line number Diff line number Diff line
# crond

> Cron container image.

## Description

Periodically run the registry's garbage collection. It should be improved to
first put the registry in a read-only mode or disable the Nginx proxy or
something.

## License

This software is licensed under the MIT license (see `LICENSE.txt`).

## Author Information

Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my
[website](https://www.shore.co.il/). Patches are welcome via
[`git send-email`](http://git-scm.com/book/en/v2/Git-Commands-Email). The repository
is located at: <https://git.shore.co.il/explore/>.

crond/crontab

0 → 100644
+1 −0
Original line number Diff line number Diff line
@weekly docker exec registry_registry_1 registry garbage-collect /etc/docker/registry/config.yml
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ services:
    restart: always
    volumes:
      - "registry:/var/lib/registry"

  reg:
    command:
      - "server"
@@ -34,6 +35,13 @@ services:
    image: r.j3ss.co/reg:v0.16.1
    restart: always

  crond:
    build:
      context: crond/
    restart: always
    volumes:
      - /run/docker.sock:/run/docker.sock

volumes:
  registry: