agenda
play

Agenda Caching Caching Gitlab Demo Caching Demos Mirroring - PowerPoint PPT Presentation

Agenda Caching Caching Gitlab Demo Caching Demos Mirroring Caching Limitations Manual Mirroring Caching Other Registries Summary 1 / 35 @sudo_bmitch How to Use Mirroring and Caching to Optimize Your Image Registry Brandon Mitchell


  1. Agenda Caching Caching Gitlab Demo Caching Demos Mirroring Caching Limitations Manual Mirroring Caching Other Registries Summary 1 / 35 @sudo_bmitch

  2. How to Use Mirroring and Caching to Optimize Your Image Registry Brandon Mitchell Twitter: @sudo_bmitch GitHub: sudo-bmitch 2 / 35

  3. Ephemeral Build Server? 3 / 35 @sudo_bmitch

  4. Cluster Pulling Remote Images? 4 / 35 @sudo_bmitch

  5. Worry About Upstream Image Changes? 5 / 35 @sudo_bmitch

  6. Build and Deploy Infrastructure Tolerant of Upstream Outages? 6 / 35 @sudo_bmitch

  7. Production Resilience 7 / 35 @sudo_bmitch

  8. Build Infrastructure 8 / 35 @sudo_bmitch

  9. Build Outage 9 / 35 @sudo_bmitch

  10. Build Resilience 10 / 35 @sudo_bmitch

  11. Faster Builds and Less Bandwidth 11 / 35 @sudo_bmitch

  12. Caching 12 / 35 @sudo_bmitch

  13. Caching is the Easy Button https://commons.wikimedia.org/wiki/File:Easy_button.JPG 13 / 35 @sudo_bmitch

  14. Cache Architecture 14 / 35 @sudo_bmitch

  15. Cache Implementation Either the dockerd CLI: dockerd --registry-mirror <cache-url> Or /etc/docker/daemon.json { "registry-mirrors": [ "<cache-url>" ] } Plus a registry: docker run -e REGISTRY_PROXY_REMOTEURL=<upstream-url> registry:2 15 / 35 @sudo_bmitch

  16. 00:00 16 / 35 @sudo_bmitch

  17. 00:00 17 / 35 @sudo_bmitch

  18. 00:00 18 / 35 @sudo_bmitch

  19. 00:00 19 / 35 @sudo_bmitch

  20. 00:00 20 / 35 @sudo_bmitch

  21. So What's the Catch? 21 / 35 @sudo_bmitch

  22. Cache Limitations The "registry-mirror" setting only applies to Docker Hub Only caches pulls not pushes Pulls still check the image manifest on Hub Credentials are in the cache server Docker implementation only supports one authentication method 22 / 35 @sudo_bmitch

  23. Options to Cache Other Registries Con�gure a squid HTTP caching proxy Pull directly from the cache Use DNS and TLS certs to send pulls to the proxy 23 / 35 @sudo_bmitch

  24. 00:00 24 / 35 @sudo_bmitch

  25. I Want More 25 / 35 @sudo_bmitch

  26. Mirroring 26 / 35 @sudo_bmitch

  27. Mirror Architecture 27 / 35 @sudo_bmitch

  28. Running a Registry Docker image docker container run -p 5000:5000 registry:2 Harbor Many Artifact Repositories 28 / 35 @sudo_bmitch

  29. Manually Mirroring docker image pull ${image} docker image tag ${image} local-mirror:5000/${image} docker image push local-mirror:5000/${image} 29 / 35 @sudo_bmitch

  30. Manual Mirror Script docker image pull "$localimg" docker image pull "$remoteimg" remoteid=$(docker image inspect "$remoteimg" --format '{.Id}') localid=$(docker image inspect "$localimg" --format '{.Id}') if [ "$remoteid" != "$localid" ]; then docker image tag "$localimg" "$localimg.$datestamp" docker image tag "$remoteimg" "$localimg" docker image push "$localimg.$datestamp" docker image push "$localimg" fi 30 / 35 @sudo_bmitch

  31. Why All the Complication? 31 / 35 @sudo_bmitch

  32. Advantages of Manually Mirroring Over Automatically Syncing Repos: Changes to images happen on your schedule Backout option exists with breaking changes Over Pull Through Cache Those reasons plus... Pushing locally built images to the registry Upstream outage doesn't stop local builds/deploys 32 / 35 @sudo_bmitch

  33. Risks of Manually Mirroring Images go stale if you do not automate the script Adding new images is an added process Recovering from a mirror outage requires populating images FROM line in images needs to point to mirror ARG REGISTRY=docker.io FROM ${REGISTRY}/alpine:3.9 ... docker build --build-arg REGISTRY=local-mirror:5000 . 33 / 35 @sudo_bmitch

  34. Summary Both Saves bandwidth Faster builds Pull Through Cache Easy to create Little maintenance Managed Mirror Control changes Tolerate upstream outages 34 / 35 @sudo_bmitch

  35. Thank You github.com/sudo-bmitch/presentations Brandon Mitchell Twitter: @sudo_bmitch GitHub: sudo-bmitch 35 / 35

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend