• Stars
    star
    140
  • Rank 252,889 (Top 6 %)
  • Language
    Go
  • License
    BSD 3-Clause "New...
  • Created over 5 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mirror docker images across image repositories

docker-mirror

build

This project will copy public DockerHub, Quay or GCR repositories to a private registry.

Install / Building

  • make sure you got Go 1.15 or newer
    • OSX: brew install go
  • make sure you have CGO enabled
    • export CGO_ENABLED=1
  • clone this repository to $HOME/src/github.com/seatgeek/docker-mirror
  • change your working directory to $HOME/go/src/github.com/seatgeek/docker-mirror
  • run go install to build and install the docker-mirror binary into your $HOME/go/bin/ directory
    • alternative: go build to build the binary and put it in the current working directory

Using

Make sure that your local Docker agent is logged into to ECR.

  • To login to ECR private registries:
    aws ecr get-login-password --region us-east-1 | docker login -u AWS --password-stdin ACCOUNT_ID.dkr.REGION.amazonaws.com
  • To login to ECR public registries:
    aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/YOUR_ECR_PUBLIC_SUFFIX
    Note that the region must be us-east-1 for ECR public registry authentication.

See AWS ECR documentation for more details

docker-mirror will automatically create the ECR repository on demand, so you do not need to login and do any UI operations in the AWS Console.

docker-mirror will look for your AWS credentials in all the default locations (env, ~/.aws/ and so forth like normal AWS tools do)

Configuration File

There are several configuration options you can use in your config.yaml below. Please see the config.yaml file in the repository for a full example.

  • ignore_tag: This option sets tags that can be ignored on pulls. (i.e. ignore_tag: - "*-alpine")

  • match_tag: This option sets the tags that you want to match on for pulls. (i.e. match_tag: - "3*")

  • max_tag_age: This option sets the max tag age you wish to pull from. (i.e. max_tag_age: 4w)

  • name: This option sets the name of your repository. (i.e. name: elasticsearch)

  • host: This options sets where do you want to mirror repositories from. Accepted values include hub.docker.com, quay.io and gcr.io. If not set, images will be pulled from Docker Hub.

  • private_registry: This option allows you to set a private Docker registry prefix for docker pulls. It will prefix any of your name: options with the private_registry name and a slash to allow you to customize where your images are being pulled through. This is particularly useful if you use a proxy to dockerhub. i.e. (private_registry: "private-registry-name")

Adding new mirror repository

  • add the new repository to the config.yaml file
    • TIP: omit the max_tag_age for the initial sync to mirror all historic tags (match_tag is fine to use in all cases)
  • run PREFIX=${reopsitory_name} docker-mirror to trigger a sync for the specific new repository (you probably don't want to sync all the existing repositories)
  • add the max_tag_age filter to the newly added repository so future syns won't cosider all historic tags

Updating / resync an existing repository

  • run PREFIX=${reopsitory_name} docker-mirror to trigger a sync for the specific repository
    • TIP: Consider if the tags you want to sync fits within the max_tag_age and other filters

Update all repositories

  • run docker-mirror and wait (for a while)

Example config.yaml

---
cleanup: true # (optional) Clean the mirrored images (default: false)
target:
  # where to copy images to
  # Below is an example of the ECR private registry.
  # To mirror repositories to a ECR public registry, replace this value with public.ecr.aws/YOUR_ECR_PUBLIC_ALIAS
  registry: ACCOUNT_ID.dkr.REGION.amazonaws.com

  # (optional) prefix all repositories with this name
  # ACCOUNT_ID.dkr.REGION.amazonaws.com/hub/jippi/hashi-ui
  prefix: "hub/"

# what repositories to copy
repositories:
    # will automatically know it's a "library" repository in dockerhub
  - name: elasticsearch
    match_tag: # tags to match, can be specific or glob pattern
      - "5.6.8" # specific tag match
      - "6.*"   # glob patterns will match
    ignore_tag: # tags to never match on (even if its matched by `tag`)
      - "*-alpine" # support both glob or specific strings

  - name: yotpo/resec
    host: hub.docker.com # mirror the repository from Docker Hub
    max_tag_age: 8w # only import tags that are 8w or less old

  - name: jippi/hashi-ui
    max_tags: 10 # only copy the 10 latest tags
    match_tag:
      - "v*"
        
  - name: kubebuilder/kube-rbac-proxy
    host: gcr.io # mirror the repository from Google Container Registry 

  - name: jippi/go-metadataproxy # import all tags

Environment Variables

Environment Variable Default Description
CONFIG_FILE config.yaml config file to use
DOCKERHUB_USER unset optional user to authenticate to docker hub with
DOCKERHUB_PASSWORD unset optional password to authenticate to docker hub with
LOG_LEVEL unset optional control the log level output
PREFIX unset optional only mirror images that match the defined prefix

More Repositories

1

fuzzywuzzy

Fuzzy String Matching in Python
Python
9,067
star
2

react-infinite

A browser-ready efficient scrolling container based on UITableView
JavaScript
2,714
star
3

thefuzz

Fuzzy String Matching in Python
Python
2,460
star
4

soulmate

Unmaintained, use Soulheart!
Ruby
1,061
star
5

SGImageCache

A flexible image caching library for image rich iOS applications
Objective-C
401
star
6

android-PlacesAutocompleteTextView

An address-autocompleting text field for Android
Java
281
star
7

djjob

PHP port of delayed_job, a database backed asynchronous priority queue
PHP
253
star
8

hashi-helper

Disaster Recovery and Configuration Management for Consul and Vault
Go
184
star
9

nomad-helper

Useful tools for working with @hashicorp Nomad at scale
Go
157
star
10

nomad-firehose

Firehose all nomad job, allocation, nodes and evaluations changes to rabbitmq, kinesis or stdout
Go
115
star
11

bash-aptfile

A simple method of defining apt-get dependencies for an application
Shell
89
star
12

businesstime

A simple python utility for calculating business time aware timedeltas between two datetimes
Python
85
star
13

react-slider

DEPRECATED: A Slider in React
JavaScript
80
star
14

docker-build-cacher

Builds a service with docker and caches the intermediate stages
Haskell
53
star
15

druzhba

Python
36
star
16

conductor

A data-backed adwords campaign bidder
Python
25
star
17

backstage-plugins

SeatGeek Backstage Plugins Collection
TypeScript
25
star
18

haldane

a friendly http interface to the aws api
Python
23
star
19

dhall-nomad

Create maintainable nomad job files
Dhall
22
star
20

SGHTTPRequest

Objective-C
17
star
21

aws-dynamic-consul-catalog

Keep your Consul service catalog in sync with your RDS instances
Go
16
star
22

tornado-async-transformer

libcst transformer that replaces tornado's legacy @gen.coroutine syntax with python3.5+ native async/await
Python
15
star
23

amqp-dispatcher

A daemon to run AMQP consumers
Python
14
star
24

statsd_rb

DEPRECATED. Use https://github.com/etsy/statsd instead of this.
Ruby
13
star
25

hell

Deprecated: Hell is an open source web interface that exposes a set of capistrano recipes as a json api, for usage within large teams
JavaScript
12
star
26

redis-health

Can be used to check the health of your Redis instance.
Go
12
star
27

SGAPI

The SG Api SDK for iOS
Objective-C
11
star
28

SGListAnimator

Provides animated transitions for your table and collection views, so you don't have to resort to calling `reloadData`.
Objective-C
10
star
29

api-support

A support channel for the SeatGeek Platform
8
star
30

react-select-option

A plain <select> component that can be styled.
JavaScript
8
star
31

circus-logstash

A Circus logger for shipping logs to Logstash
Python
6
star
32

nomad-crashloop-detector

detect Nomad allocation crash-loops, by consuming the allocation stream from nomad-firehose
Go
5
star
33

gramo

Kotlin
5
star
34

datadog-service-helper

use consul catalog to manage datadog service checks
Go
4
star
35

wrecker-ui

An HTML interface for wrecker, the load testing tool
Elm
4
star
36

graceful_listener

net.Listener implementation for graceful shutdown
Go
4
star
37

sgcli

A command-line interface for SeatGeek
Python
4
star
38

logrus-gelf-formatter

Formats logrus messages in the GELF JSON format
Go
3
star
39

geocoder-java

Fork of https://code.google.com/p/geocoder-java/
Java
3
star
40

homebrew-formulae

Custom SeatGeek Formula for Homebrew
Ruby
3
star
41

k8s-reconciler-generic

A generic Kubernetes reconciler abstraction based on kubebuilder
Go
3
star
42

sgmods-go

Codemods for golang from SeatGeek.
Go
1
star
43

api-intro-presentation

1
star
44

greenhouse-api-client

Kotlin
1
star
45

seatgeek-emea-ios-sdk

Swift
1
star
46

elastic-search-health

Go
1
star
47

vault-stress

Go
1
star
48

sfn-stack-profile

Ruby
1
star
49

eslint-config-seatgeek-react-standard

React rules specific to the SeatGeek repositories.
JavaScript
1
star