Giter VIP home page Giter VIP logo

dockerdd's Introduction

Dockerdd

Dockerdd is a simple Python script to replicate Docker images between registries.

Why Dockerdd

If you have multiple registries and want to keep some images in sync, this script might be your solution. You simply describe the sync in a yaml file and run the script.

Installation

To run this script, you will need:

  • Python (including pip)
  • Docker
  • Python's Docker library

To install the Docker library for Python, run the following command:

pip install docker

Create the jobs file

This is the structure of a jobs file, it's in yaml format:

registries:
  <registry-name>:
    address: <registry url without the 'http(s)://', or use 'default'>
    folder: <an optional folder name to use at the target registry>
  <registry-name-2>:
    address: ...
  <registry-name-3>:
    address: ...
    folder: ...

imagelists:
  <imagelist-name>:
    - image1:tag
    - image2:tag
    - image3:tag
  <imagelist-name-2>:
    - ...

jobs:
  <job-name>:
    source: <source registry-name>
    target: <target registry-name>
    imagelists:
      - <imagelist-name-1>
      - <imagelist-name-2>
      - ...
  <job-name-2>:
    source: ...
    ...

First define the registries you want to use. Define the registry's address, e.g. harbor.mydomain.com/dev-images. You can also use 'default', in that case Docker will use the default registry as defined by the Docker configuration. Optionally define a target folder location. If folder is not defined, the root of the target repository will be used.

Next define imagelists. Each imagelist has a name and contains a list of images (with tags).

Finally defines jobs. Each job copies the given imagelists from the given source registry to the target registry.

You can define multiple jobs and imagelists. Jobs will be performed in the given order.

Run the script

dockerdd.py <jobs-file>

Authentication

Some registries require authentication, this is not handled by Dockerdd. You can authenticate once (manually) using docker login, the secrets will be stored in ~/.docker/config.json.

Gitlab pipeline

The file example-gitlab-ci.yml demonstrates you how you can run this script in a pipeline.

License: GPL 3.0

Copyright (C) Ernest Neijenhuis PA3HCM

Dockerdd is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Dockerdd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Dockerdd. If not, see http://www.gnu.org/licenses/.

Project information

  • Author: Ernest Neijenhuis
  • Code on Github: https://github.com/pa3hcm/dockerdd

dockerdd's People

Contributors

pa3hcm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.