Docker (software): Difference between revisions

 
(2 intermediate revisions by the same user not shown)
Line 208: Line 208:
Alternative public registries:
Alternative public registries:
* [https://gallery.ecr.aws/ AWS ECR Gallery] has a mirror for all official docker containers.
* [https://gallery.ecr.aws/ AWS ECR Gallery] has a mirror for all official docker containers.
==Caching==
If you want your builds to be fast on CICD, you have to setup [https://docs.docker.com/build/cache/ caching].
In particular you should:
* Enable [https://docs.docker.com/build/buildkit/ buildkit] by setting the environment variable <code>DOCKER_BUILDKIT=1</code>
* Use <code>--cache-from</code> in your build.
* Setup external caching, e.g. with <code>--build-arg BUILDKIT_INLINE_CACHE=1</code>.
** Use <code>--arg BUILDKIT_INLINE_CACHE=1</code> if using <code>docker buildx build</code>.
* For multistage builds, cache each stage in your container registry.
;Resources
* https://michalwojcik.com.pl/2021/01/21/using-cache-in-multi-stage-builds-in-gitlab-ci-docker/
* https://testdriven.io/blog/faster-ci-builds-with-docker-cache/#multi-stage-builds
==Useful Services==
* [https://containrrr.dev/watchtower/ https://containrrr.dev/watchtower/] is a tool which will automatically update your docker containers when new images are published. It also has an http endpoint to trigger checks manually e.g. from CI/CD.
==My Images==
I have a few custom container images below:
* [https://github.com/dli7319/docker-anki-server ghcr.io/dli7319/docker-anki-server:main]
* [https://github.com/dli7319/docker-nextcloud ghcr.io/dli7319/docker-nextcloud:main]
* [https://github.com/dli7319/docker-mediawiki ghcr.io/dli7319/docker-mediawiki:main]


==Resources==
==Resources==
* [https://www.youtube.com/watch?v=fqMOX6JJhGo freeCodeCamp.org Docker Tutorial for Beginners Video]
* [https://www.youtube.com/watch?v=fqMOX6JJhGo freeCodeCamp.org Docker Tutorial for Beginners Video]