Skip to content

INOS-soft/Python-LS-LOCKING-Retunning-access

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<<<<<<< HEAD

Awesome Docker Awesome Netlify Status

A curated list of Docker resources and projects

If you would like to contribute, please read CONTRIBUTING.md first. It contains a lot of tips and guidelines to help keep things organized. Just click README.md to submit a pull request. If this list is not complete, you can contribute to make it so. Here is a great video tutorial to learn how to contribute on Github.

You can see the updates on TWITTER

Please, help organize these resources so that they are easy to find and understand for newcomers. See how to Contribute for tips!

If you see a link here that is not (any longer) a good fit, you can fix it by submitting a pull request to improve this file. Thank you!

The creators and maintainers of this list do not receive any form of payment to accept a change made by any contributor. This page is not an official Docker product in any way. It is a list of links to projects and is maintained by volunteers. Everybody is welcome to contribute. The goal of this repo is to index open-source projects, not to advertise for profit.

All the links are monitored and tested with a home baked Node.js script

Contents

Legend

  • Abandoned đź’€
  • Beta 🚧
  • Monetized đź’˛

What is Docker

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications. Consisting of Docker Engine, a portable, lightweight runtime and packaging tool, and Docker Hub, a cloud service for sharing applications and automating workflows, Docker enables apps to be quickly assembled from components and eliminates the friction between development, QA, and production environments. As a result, IT can ship faster and run the same app, unchanged, on laptops, data center VMs, and any cloud.

Source: What is Docker

Where to start

  • Benefits of using Docker for development and delivery, with a practical roadmap for adoption.
  • Docker Curriculum: A comprehensive tutorial for getting started with Docker. Teaches how to use Docker and deploy dockerized apps on AWS with Elastic Beanstalk and Elastic Container Service.
  • Docker Documentation: the official documentation.
  • Docker for beginners: A tutorial for beginners who need to learn the basics of Docker—from "Hello world!" to basic interactions with containers, with simple explanations of the underlying concepts.
  • Docker for novices An introduction to Docker for developers and testers who have never used it. (Video 1h40, recorded linux.conf.au 2019 — Christchurch, New Zealand) by Alex Clews.
  • Docker Training đź’˛
  • Docker Tutorial for Beginners (Updated 2019 version) — In this Docker tutorial, you'll learn all the basics and learn how you can containerize Node.js and Go applications. Even if you aren't familiar with these languages it should be easy for you to follow this tutorial and use any other language.
  • Katacoda: Learn Docker using Interactive Browser-Based Labs
  • Learn Docker: step-by-step tutorial and more resources (video, articles, cheat sheets) by @dwyl
  • Play With Docker: PWD is a great way to get started with Docker from beginner to advanced users. Docker runs directly in your browser.
  • Practical Guide about Docker Commands in Spanish This spanish guide contains the use of basic docker commands with real life examples.
  • Practical Introduction to Container Terminology The landscape for container technologies is larger than just docker. Without a good handle on the terminology, It can be difficult to grasp the key differences between docker and (pick your favorites, CRI-O, rkt, lxc/lxd) or understand what the Open Container Initiative is doing to standardize container technology.
  • The Docker Handbook This 10,000+ words article is divided into 38 sections and walks readers through all the fundamentals of Docker with project examples.

Cheatsheets by

Where to start (Windows)


Projects

  • Moby = open source development
  • Docker CE = free product release based on Moby
  • Docker EE = commercial product release based on Docker CE.

Docker EE is on the same code base as Docker CE, so also built from Moby, with commercial components added, such as "docker data center / universal control plane"

Container Operations

Container Composition

  • bocker (2) - Write Dockerfile completely in Bash. Extensible and simple. --> Reusable by @icy
  • bocker (1) đź’€ - Docker implemented in 100 lines of bash by p8952
  • box - Build Dockerfile images with a mruby DSL, includes flattening and layer manipulation
  • Capitan - Composable docker orchestration with added scripting support by @byrnedo.
  • compose_plantuml đź’€ - Generate Plantuml graphs from docker-compose files by @funkwerk
  • Composerize - Convert docker run commands into docker-compose files
  • crowdr - Tool for managing multiple Docker containers (docker-compose alternative) by @polonskiy
  • docker-compose-graphviz đź’€ - Turn a docker-compose.yml files into Graphviz .dot files by @abesto
  • docker-config-update - Utility to update docker configs and secrets for deploying in a compose file by @sudo-bmitch
  • draw-compose đź’€ - Utility to draw a schema of a docker compose by @Alexis-benoist
  • elsy - An opinionated, multi-language, build tool based on Docker and Docker Compose
  • habitus - A Build Flow Tool for Docker by @cloud66
  • kompose - Go from Docker Compose to Kubernetes
  • Maestro đź’€ - Maestro provides the ability to easily launch, orchestrate and manage multiple Docker containers as single unit by @tascanini
  • percheron đź’€ - Organise your Docker containers with muscle and intelligence by @ashmckenzie
  • podman-compose - a script to run docker-compose.yml using podman by @containers
  • plash - A container run and build engine - runs inside docker.
  • rocker-compose đź’€ - Docker composition tool with idempotency features for deploying apps composed of multiple containers. By@grammarly.
  • rocker đź’€ - Extended Dockerfile builder. Supports multiple FROMs, MOUNTS, templates, etc. by @grammarly.
  • Stacker - Docker Compose Templates. Stacker provides an abstraction layer over Docker Compose and a better DX (developer experience).
  • Stitchocker - A lightweight and fast command line utility for conveniently grouping your docker-compose multiple container services. By @alexaandrov
  • Smalte – Dynamically configure applications that require static configuration in docker container. By @roquie
  • Zodiac đź’€ - A lightweight tool for easy deployment and rollback of dockerized applications. By @CenturyLinkLabs

Deployment and Infrastructure

  • blackfish - a CoreOS VM to build swarm clusters for Dev & Production by @blackfish
  • BosnD - BosnD, the boatswain daemon - A dynamic configuration file writer & service reloader for dynamically changing container environments.
  • Centurion - Centurion is a mass deployment tool for Docker fleets. It takes containers from a Docker registry and runs them on a fleet of hosts with the correct environment variables, host volume mappings, and port mappings. By @newrelic
  • Clocker - Clocker creates and manages a Docker cloud infrastructure. Clocker supports single-click deployments and runtime management of multi-node applications that run as containers distributed across multiple hosts, on both Docker and Marathon. It leverages Calico and Weave for networking and Brooklyn for application blueprints. By @brooklyncentral
  • Conduit - Experimental deployment system for Docker by @ehazlett
  • depcon - Depcon is written in Go and allows you to easily deploy Docker containers to Apache Mesos/Marathon, Amazon ECS and Kubernetes. By @ContainX
  • deploy đź’€ - Git and Docker deployment tool. A middle ground between simple Docker composition tools and full blown cluster orchestration by @ttiny
  • dockit đź’€ - Do docker actions and Deploy gluster containers! By @humblec
  • gitkube - Gitkube is a tool for building and deploying docker images on Kubernetes using git push. By @Hasura.
  • Grafeas - A common API for metadata about containers, from image and build details to security vulnerabilities. By grafeas
  • Longshoreman đź’€ - Longshoreman automates application deployment using Docker. Just create a Docker repository (or use a service), configure the cluster using AWS or Digital Ocean (or whatever you like) and deploy applications using a Heroku-like CLI tool. By longshoreman
  • SwarmManagement - Swarm Management is a python application, installed with pip. The application makes it easy to manage a Docker Swarm by configuring a single yaml file describing which stacks to deploy, and which networks, configs or secrets to create.
  • werf - werf is a CI/CD tool for building Docker images efficiently and deploying them to Kubernetes using GitOps by @flant

Monitoring

  • Autoheal - Monitor and restart unhealthy docker containers automatically.
  • Axibase Collector - Axibase Collector streams performance counters, configuration changes and lifecycle events from the Docker engine(s) into Axibase Time Series Database for roll-up dashboards and integration with upstream monitoring systems.
  • cAdvisor - Analyzes resource usage and performance characteristics of running containers. Created by @Google
  • dockprom - Docker hosts and containers monitoring with Prometheus, Grafana, cAdvisor, NodeExporter and AlertManager by @stefanprodan
  • Docker-Alertd - Monitor and send alerts based on docker container resource usage/statistics
  • Docker-Flow-Monitor - Reconfigures Prometheus when a new service is updated or deployed automatically by @docker-flow
  • Dockerana đź’€ - packaged version of Graphite and Grafana, specifically targeted at metrics from Docker.
  • DockProc - I/O monitoring for containers on processlevel.
  • Dozzle - Monitor container logs in real-time with a browser or mobile device. @amir20
  • Dynatrace đź’˛ - Monitor containerized applications without installing agents or modifying your Run commands
  • Glances - A cross-platform curses-based system monitoring tool written in Python by @nicolargo
  • Grafana Docker Dashboard Template - A template for your Docker, Grafana and Prometheus stack @vegasbrianc
  • InfluxDB, cAdvisor, Grafana - InfluxDB Time series DB in combination with Grafana and cAdvisor by @vegasbrianc
  • LogJam - Logjam is a log forwarder designed to listen on a local port, receive log entries over UDP, and forward these messages on to a log collection server (such as logstash) by @gocardless
  • Logspout - Log routing for Docker container logs by @gliderlabs
  • monit-docker - Monitor docker containers resources usage or status and execute docker commands or inside containers. [@decryptus][decryptus]
  • NexClipper - NexClipper is the container monitoring and performance management solution specialized in Docker, Apache Mesos, Marathon, DC/OS, Mesosphere, Kubernetes by @Nexclipper
  • Out-of-the-box Host/Container Monitoring/Logging/Alerting Stack - Docker host and container monitoring, logging and alerting out of the box using cAdvisor, Prometheus, Grafana for monitoring, Elasticsearch, Kibana and Logstash for logging and elastalert and Alertmanager for alerting. Set up in 5 Minutes. Secure mode for production use with built-in Automated Nginx Reverse Proxy (jwilder's).
  • SwarmAlert - Monitors a Docker Swarm and sends Pushover alerts when it finds a container with no healthy service task running.
  • Zabbix Docker module - Zabbix module that provides discovery of running containers, CPU/memory/blk IO/net container metrics. Systemd Docker and LXC execution driver is also supported. It's a dynamically linked shared object library, so its performance is (~10x) better, than any script solution.
  • Zabbix Docker - Monitor containers automatically using zabbix LLD feature.

Networking

  • Calico-Docker - Calico is a pure layer 3 virtual network that allows containers over multiple docker-hosts to talk to each other.
  • Flannel - Flannel is a virtual network that gives a subnet to each host for use with container runtimes. By @coreos
  • Freeflow - High performance container overlay networks on Linux. Enabling RDMA (on both InfiniBand and RoCE) and accelerating TCP to bare metal performance. By @Microsoft
  • netshoot - The netshoot container has a powerful set of networking tools to help troubleshoot Docker networking issues by @nicolaka
  • Pipework - Software-Defined Networking for Linux Containers, Pipework works with "plain" LXC containers, and with the awesome Docker. By @jpetazzo
  • Weave (The Docker network) - Weave creates a virtual network that connects Docker containers deployed across multiple hosts.

Orchestration

  • athena - An automation platform with a plugin architecture that allows you to easily create and share services.
  • blimp đź’€ - Uses Docker Machine to easily move a container from one Docker host to another, show containers running against all of your hosts, replicate a container across multiple hosts and more by @defermat and @schvin
  • CloudSlang - CloudSlang is a workflow engine to create Docker process automation
  • clusterdock - Docker container orchestration to enable the testing of long-running cluster deployments
  • ContainerShip đź’€ - A simple container management platform
  • Crane - Control plane based on docker built-in swarm @Dataman-Cloud
  • Docker Flow Swarm Listener - Docker Flow Swarm Listener project is to listen to Docker Swarm events and send requests when a change occurs. By @docker-flow
  • gantryd đź’€ - A framework for easy management of docker-based components across machines by @DevTable
  • Haven - Haven is a simplified container management platform that integrates container, application, cluster, image, and registry managements. By @codeabovelab
  • Helios đź’€ - A simple platform for deploying and managing containers across an entire fleet of servers by @spotify
  • Kontena đź’€ - The developer friendly container and micro services platform. Works on any cloud, easy to setup, simple to use.
  • Kubernetes - Open source orchestration system for Docker containers by Google
  • ManageIQ - Discover, optimize and control your hybrid IT. By ManageIQ
  • Mantl - Mantl is a modern platform for rapidly deploying globally distributed services
  • Marathon - Marathon is a private PaaS built on Mesos. It automatically handles hardware or software failures and ensures that an app is "always on"
  • Mesos - Resource/Job scheduler for containers, VM's and physical hosts @apache
  • Nebula - A Docker orchestration tool designed to manage massive scale distributed clusters.
  • Nomad - Easily deploy applications at any scale. A Distributed, Highly Available, Datacenter-Aware Scheduler by @hashicorp
  • Panamax đź’€ - An open-source project that makes deploying complex containerized apps as easy as Drag-and-Drop by @CenturyLinkLabs.
  • Rancher - An open source project that provides a complete platform for operating Docker in production by @rancher.
  • Swarm-cronjob - Create jobs on a time-based schedule on Swarm by @crazy-max

PaaS

  • Atlantis đź’€ - Atlantis is an Open Source PaaS for HTTP applications built on Docker and written in Go
  • caprover - [previously known as CaptainDuckDuck] Automated Scalable Webserver Package (automated Docker+nginx) - Heroku on Steroids
  • Convox Rack - Convox Rack is open source PaaS built on top of expert infrastructure automation and devops best practices.
  • Dcw - Docker-compose SSH wrapper: a very poor man PaaS, exposing the docker-compose and custom-container commands defined in container labels.
  • Dokku - Docker powered mini-Heroku that helps you build and manage the lifecycle of applications (originally by @progrium)
  • Empire - A PaaS built on top of Amazon EC2 Container Service (ECS)
  • Exoframe - A self-hosted tool that allows simple one-command deployments using Docker
  • Flynn - A next generation open source platform as a service
  • Hephy Workflow - Open source PaaS for Kubernetes that adds a developer-friendly layer to any Kubernetes cluster, making it easy to deploy and manage applications. Fork of Deis Workflow
  • Nanobox đź’˛ - An application development platform that creates local environments that can then be deployed and scaled in the cloud.
  • OpenShift - An open source PaaS built on Kubernetes and optimized for Dockerized app development and deployment by Red Hat
  • Tsuru - Tsuru is an extensible and open source Platform as a Service software

Reverse Proxy

Runtime

  • aind - AinD launches Android apps in Docker, by nesting Anbox containers inside Docker by @aind-containers
  • cri-o - Open Container Initiative-based implementation of Kubernetes Container Runtime Interface by cri-o
  • lxc - LXC - Linux Containers
  • podman - libpod is a library used to create container pods. Home of Podman by @containers
  • rlxc - LXC binary written in Rust by @brauner
  • runtime-tools - oci-runtime-tool is a collection of tools for working with the OCI runtime specification by @opencontainers

Security

  • Anchor Engine - Analyze images for CVE vulnerabilities and against custom security policies by @Anchor
  • Aqua Security đź’˛ - Securing container-based applications from Dev to Production on any platform
  • bane - AppArmor profile generator for Docker containers by @genuinetools
  • CIS Docker Benchmark - This InSpec compliance profile implement the CIS Docker 1.12.0 Benchmark in an automated way to provide security best-practice tests around Docker daemon and containers in a production environment. By @dev-sec
  • Clair - Clair is an open source project for the static analysis of vulnerabilities in appc and docker containers. By @coreos
  • Dagda - Dagda is a tool to perform static analysis of known vulnerabilities, trojans, viruses, malware & other malicious threats in docker images/containers and to monitor the docker daemon and running docker containers for detecting anomalous activities. By @eliasgranderubio
  • Deepfence Enterprise đź’˛ - Full life cycle Cloud Native Workload Protection platform for kubernetes, virtual machines and serverless. By @deepfence
  • Deepfence Threat Mapper - Powerful runtime vulnerability scanner for kubernetes, virtual machines and serverless. By @deepfence
  • docker-bench-security - script that checks for dozens of common best-practices around deploying Docker containers in production. By @docker
  • docker-explorer - A tool to help forensicate offline docker acquisitions by @Google
  • docker-lock - A cli-plugin for docker to automatically manage image digests by tracking them in a separate Lockfile. By @safe-waters
  • notary - a server and a client for running and interacting with trusted collections. By @TUF
  • oscap-docker - OpenSCAP provides oscap-docker tool which is used to scan Docker containers and images. By OpenSCAP
  • Phonito Security đź’˛ - a Docker vulnerability scanner with constant Kubernetes monitoring and pipeline integration.
  • Prisma Cloud đź’˛ - (previously Twistlock Security Suite) detects vulnerabilities, hardens container images, and enforces security policies across the lifecycle of applications.
  • Sysdig Falco - Sysdig Falco is an open source container security monitor. It can monitor application, container, host, and network activity and alert on unauthorized activity.
  • Sysdig Secure đź’˛ - Sysdig Secure addresses run-time security through behavioral monitoring and defense, and provides deep forensics based on open source Sysdig for incident response.
  • Trend Micro DeepSecurity đź’˛ - Trend Micro DeepSecurity offers runtime protection for container workloads and hosts as well as preruntime scanning of images to identify vulnerabilities, malware and content such as hardcoded secrets.
  • Trivy - Aqua Security's open source simple and comprehensive vulnerability scanner for containers (suitable for CI).

Service Discovery

Volume Management / Data

  • Blockbridge đź’˛- The Blockbridge plugin is a volume plugin that provides access to an extensible set of container-based persistent storage options. It supports single and multi-host Docker environments with features that include tenant isolation, automated provisioning, encryption, secure deletion, snapshots and QoS. By @blockbridge
  • Convoy - an open-source Docker volume driver that can snapshot, backup and restore Docker volumes anywhere. By @rancher
  • Docker Machine NFS Activates NFS for an existing boot2docker box created through Docker Machine on OS X.
  • Docker Unison A docker volume container using Unison for fast two-way folder sync. Created as an alternative to slow boot2docker volumes on OS X. By @leighmcculloch
  • Local Persist Specify a mountpoint for your local volumes (created via docker volume create) so that files will always persist and so you can mount to different directories in different containers.
  • Minio - S3 compatible object storage server in Docker containers
  • Netshare Docker NFS, AWS EFS, Ceph & Samba/CIFS Volume Plugin. By @ContainX
  • portworx đź’˛ - Decentralized storage solution for persistent, shared and replicated volumes.
  • quobyte đź’˛ - fully fault-tolerant distributed file system with a docker volume driver
  • REX-Ray provides a vendor agnostic storage orchestration engine. The primary design goal is to provide persistent storage for Docker, Kubernetes, and Mesos. By@thecodeteam (DELL Technologies)
  • Storidge đź’˛ - Software-defined Persistent Storage for Kubernetes and Docker Swarm

User Interface

Desktop

Native desktop applications for managing and montoring docker hosts and clusters

Terminal

  • captain - Easily start and stop docker compose projects from any directory. By @jenssegers
  • ctop (1) - A command line / text based Linux Containers monitoring tool that works just like you expect (Python) by @yadutaf
  • ctop (2) - Top-like interface for container metrics (Golang) by @bcicen
  • dext-docker-registry-plugin - Search the Docker Registry with the Dext smart launcher.
  • dive - A tool for exploring each layer in a docker image. By wagoodman.
  • docker-ls - CLI tools for browsing and manipulating docker registries by @mayflower
  • docker-ssh - SSH Server for Docker containers ~ Because every container should be accessible. By @jeroenpeeters
  • Docker-mon đź’€ - Console-based Docker monitoring by @icecrime
  • docker.el Manage docker from Emacs by Silex
  • dockercraft - Docker + Minecraft = Dockercraft by @docker
  • dockerfile-mode An emacs mode for handling Dockerfiles by @spotify
  • docker pushrm - A Docker CLI plugin that that lets you push the README.md file from the current directory to Docker Hub. Also supports Quay and Harbor. By @christian-korneck
  • dockersql - A command line interface to query Docker using SQL by @crosbymichael
  • DockSTARTer - DockSTARTer helps you get started with home server apps running in Docker by (GhostWriters)
  • dockly - An interactive shell UI for managing Docker containers by @lirantal
  • dry - An interactive CLI for Docker containers by @moncho
  • DVM - Docker version manager by @howtowhale
  • goinside - Get inside a running docker container easily. by @iamsoorena
  • lazydocker - The lazier way to manage everything docker. A simple terminal UI for both docker and docker-compose, written in Go with the gocui library. By @jesseduffield
  • MultiDocker - Create a secure multi-user Docker machine, where each user is segregated into an indepentent container.
  • ns-enter - no more ssh, enter name spaces of container by @jpetazzo
  • Pdocker - A simple tool to manage and maintain Docker for personal projects by @g31s
  • Powerline-Docker - A Powerline segment for showing the status of Docker containers by @adrianmo
  • proco - Proco will help you to organise and manage Docker, Docker-Compose, Kubernetes projects of any complexity using simple YAML config files to shorten the route from finding your project to initialising it in your local environment. by @shiwaforce
  • reg - Docker registry v2 command line client by @genuinetools
  • scuba - Transparently use Docker containers to encapsulate software build environments, by @JonathonReinhart
  • sen - Terminal user interface for docker engine, by @TomasTomecek
  • skopeo - Work with remote images registries - retrieving information, images, signing content by @containers
  • supdock - Allows for slightly more visual usage of Docker with an interactive prompt. By @segersniels
  • tsaotun - Python based Assistance for Docker by @qazbnm456
  • wharfee - Autocompletion and syntax highlighting for Docker commands. by @j-bennet

Web

  • Container Web TTY - Connect your containers via a web-tty @wrfly
  • Docker Compose UI - Manage docker-compose via HTTP. docker-compose-ui runs in a Docker container, mounts the hosts docker socket and exposes a RESTful API and AngularJS GUI
  • Docker Registry Browser - Web Interface for the Docker Registry HTTP API v2 by @klausmeyer
  • Docker Registry UI - A web UI for easy private/local Docker Registry integration by @atcol
  • Docker Registry UI (Joxit) - The simplest and cleanest UI for private registries by @Joxit
  • docker-registry-web - Web UI, authentication service and event recorder for private docker registry v2 by @mkuchin
  • docker-swarm-visualizer - Visualizes Docker services on a Docker Swarm (for running demos).
  • dockering-on-rails đź’€ - Simple Web-Interface for Docker with a lot of features by @Electrofenster
  • DockerSurfer đź’€ - A web service for analyze and browse dependencies between Docker images in the Docker registry, by @Simone-Erba
  • Kubevious - A highly visual web UI for Kubernetes which renders configuration and state in an application centric way by @rubenhak.
  • OctoLinker - A browser extension for GitHub that makes the image name in a Dockerfile clickable and redirect you to the related Docker Hub page.
  • Portainer - A lightweight management UI for managing your Docker hosts or Docker Swarm clusters by @portainer
  • Rapid Dashboard - A simple query dashboard to use Docker Remote API by @ozlerhakan
  • Seagull - Friendly Web UI to monitor docker daemon. by @tobegit3hub
  • Swarmpit - Swarmpit provides simple and easy to use interface for your Docker Swarm cluster. You can manage your stacks, services, secrets, volumes, networks etc.
  • Swirl - Swirl is a web management tool for Docker, focused on swarm cluster By @cuigh
  • Theia - Extensible platform to develop full-fledged multi-language Cloud & Desktop IDE-like products with state-of-the-art web technologies.
  • Yacht 🚧 - A Web UI for docker that focuses on templates and ease of use in order to make deployments as easy as possible. By @SelfhostedPro

Docker Images

Base Tools

Tools and applications that are either installed inside containers or designed to be run as a sidecar

  • amicontained - Container introspection tool. Find out what container runtime is being used as well as features available by @genuinetools
  • autodock - Daemon for Docker Automation by @prologic
  • Chaperone - A single PID1 process designed for docker containers. Does user management, log management, startup, zombie reaping, all in one small package. by @garywiz
  • ckron - A cron-style job scheduler for docker, by @nicomt
  • CoreOS - Linux for Massive Server Deployments
  • distroless - Language focused docker images, minus the operating system, by @GoogleContainerTools
  • docker-alpine - A super small Docker base image (5MB) using Alpine Linux by @gliderlabs
  • docker-gen - Generate files from docker container meta-data by @jwilder
  • dockerize - Utility to simplify running applications in docker containers by @jwilder
  • GoSu - Run this specific application as this specific user and get out of the pipeline (entrypoint script tool) by @tianon
  • is-docker - Check if the process is running inside a Docker container by @sindresorhus
  • lstags - sync Docker images across registries by @ivanilves
  • NVIDIA-Docker - The NVIDIA Container Runtime for Docker by @NVIDIA
  • sue - Executes a program as a user different from the user running sue. This is a maintainable alternative to ncopa/su-exec, which is the better tianon/gosu. This one is far better (higher performance, smaller size), than the original gosu, however it is far easier to maintain, than su-exec, which is written in plain C. Made by @theAkito
  • su-exec - This is a simple tool that will simply execute a program with different privileges. The program will be excuted directly and not run as a child, like su and sudo does, which avoids TTY and signal issues. Why reinvent gosu? This does more or less exactly the same thing as gosu but it is only 10kb instead of 1.8MB. By ncopa
  • supercronic - crontab-compatible job runner, designed specifically to run in containers by @aptible
  • TrivialRC - A minimalistic Runtime Configuration system and process manager for containers @vorakl

Builder

Applications designed to help or simplify building new images

  • ansible-bender - A tool utilising ansible and buildah by @TomasTomecek
  • buildah - A tool that facilitates building OCI images by @containers
  • BuildKit - Concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit by @moby project
  • cekit - A tool used by openshift to build base images using different build engines by @cekit.
  • container-diff - An image tool for comparing and analzying container images by @GoogleContainerTools
  • container-factory - Produces Docker images from tarballs of application source code by @mutable
  • copy-docker-image - Copy a Docker image between registries without a full Docker installation by @mdlavin
  • Derrick - A tool help you to automate the generation of Dockerfile and dockerize application by scanning the code. By @alibaba.
  • dlayer - Stats collector for Docker layers by @wercker
  • docker-companion - A command line tool written in Golang to squash and unpack docker images by @mudler
  • docker-make - Build, tag,and push a bunch of related docker images via a single command.
  • docker-replay - Generate docker runcommand and options from running containers. By bcicen
  • DockerMake - A reproducible Docker image build system for complex software stacks. By @avirshup
  • DockerSlim shrinks fat Docker images creating the smallest possible images.
  • Dockly - Dockly is a gem made to ease the pain of packaging an application in Docker by @swipely
  • dockramp đź’€ - Proof of Concept: A Client Driven Docker Image Builder by @jlhawn
  • essex - Boilerplate for Docker Based Projects: Essex is a CLI utility written in bash to quickly setup clean and consistent Docker projects with Makefile driven workflows. @jamesbrink
  • HPC Container Maker - Generates Dockerfiles from a high level Python recipe, including building blocks for High-Performance Computing components by @NVIDIA
  • img - Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder by @genuinetools
  • kaniko - Build Container Images In Kubernetes. By @GoogleContainerTools
  • makisu - Uber's fast and flexible unprivileged image builder for Mesos and Kubernetes, with distributed cache support. By @uber
  • MicroBadger - Analyze the contents of images and add metadata labels
  • packer - Hashicorp tool to build machine images including docker image integrated with configuration management tools like chef, puppet, ansible
  • portainer - Apache Mesos framework for building Docker images by @duedil-ltd
  • Production-Ready Python Containers đź’˛ - A template for creating production-ready Docker images for Python applications.
  • runlike - Generate docker runcommand and options from running containers by @lavie
  • SkinnyWhale đź’€ - Skinnywhale helps you make smaller (as in megabytes) Docker containers.
  • Smith - A Micocontainer Builder and can perform multi-stage builds after the image is built Oracle
  • Whaler - Program to reverse Docker images into Dockerfiles by @P3GLEG.
  • Whales - A tool to automatically dockerize your applications by @icalialabs.

Dockerfile

  • chaperone-docker - A set of images using the Chaperone process manager, including a lean Alpine image, LAMP, LEMP, and bare-bones base kits.
  • Dockerfile Generator dfg is both a Go library and an executable that produces valid Dockerfiles using various input channels.
  • Dockerfile Generator
  • Dockerfile Project - Trusted Automated Docker Builds. Dockerfile Project maintains a central repository of Dockerfile for various popular open source software services runnable on a Docker container.
  • Dockershelf - A repository that serves as a collector for docker recipes that are universal, efficient and slim. Images are updated, tested and published daily via a Travis cron job. Maintained by @CollageLabs.
  • dockmoor 🚧 - Manage docker image references and help to create reproducible builds with Docker. By @MeneDev
  • Vektorcloud - A collection of minimal, Alpine-based Docker images

Examples by:

Linter

Metadata

  • opencontainer - A convention and shared namespace for Docker labels defined by OCI Image Spec.

Registry

Services to securely store your Docker images.

  • Amazon EC2 Container Registry đź’˛ - Amazon EC2 Container Registry (ECR) is a fully-managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images.
  • Azure Container Registry đź’˛ - Manage a Docker private registry as a first-class Azure resource
  • CargoOS - A bare essential OS for running the Docker Engine on bare metal or Cloud. By @RedCoolBeans
  • Cloudsmith đź’˛ - A fully managed package management SaaS, with first-class support for public and private Docker registries (and many others, incl. Helm charts for the Kubernetes ecosystem). Has a generous free-tier and is also completely free for open-source.
  • Cycle.io đź’˛ - Bare-metal container hosting.
  • cleanreg - A small tool to delete image manifests from a Docker Registry implementing the API v2, dereferencing them for the GC by @hcguersoy
  • Dist đź’˛ - Private cloud-based Docker container registry
  • Docker Hub provided by Docker Inc.
  • Docker Registry v2 - The Docker toolset to pack, ship, store, and deliver content
  • Docket - Custom docker registry that allows for lightning fast deploys through bittorrent by @netvarun
  • GCE Container Registry đź’˛ Fast, private Docker image storage on Google Cloud Platform
  • GitLab Container Registry - Repositories focused on using it images in GitLab CI
  • Harbor An open source trusted cloud native registry project that stores, signs, and scans content. Supports replication, user management, access control and activity auditing. By CNCF formerly VMWare
  • JFrog Artifactory đź’˛ - Artifact Repository Manager, can be used as private Docker Registry as well
  • Kraken - Uber's Highly scalable P2P docker registry, capable of distributing TBs of data in seconds.
  • Portus - Authorization service and frontend for Docker registry (v2) by @SUSE
  • Private Docker Registry đź’˛ - Dedicated Conainer Registry Service with unlimited private repositories, users, teams, namespaces together with enterprise grade authentication LDAP/AD/OAuth/SAML.
  • Quay.io đź’˛ (part of CoreOS) - Secure hosting for private Docker repositories
  • Rescoyl - Private Docker registry (free and open source) by @noteed
  • Sonatype Nexus - Repository with Universal Support, also for Docker images
  • TreeScale - Build and Distribute container based applications. By @tigranbs

Development with Docker

API Client

CI/CD

  • Buddy đź’˛ - The best of Git, build & deployment tools combined into one powerful tool that supercharged our development.
  • Captain - Convert your Git workflow to Docker containers ready for Continuous Delivery by @harbur.
  • Cyclone - Powerful workflow engine and end-to-end pipeline solutions implemented with native Kubernetes resources by @caicloud.
  • Diun - Receive notifications when an image or repository is updated on a Docker registry by @crazy-max.
  • Docker plugin for Jenkins - The aim of the docker plugin is to be able to use a docker host to dynamically provision a slave, run a single build, then tear-down that slave.
  • Dockupdater - Automatically keep your docker services and your docker containers up-to-date
  • Drone - Continuous integration server built on Docker and configured using YAML files.
  • GitLab Runner - GitLab has integrated CI to test, build and deploy your code with the use of GitLab runners.
  • GOCD-Docker đź’€ - Go Server and Agent in docker containers to provision.
  • Microservices Continuous Deployment - Continuous deployment of a microservices application.
  • mu - Tool to configure CI/CD of your container applications via AWS CodePipeline, CodeBuild and ECS @Stelligent
  • Ouroboros đź’€ - Automatically update running Docker containers with notifications
  • Popper - Github actions workflow (HCL syntax) execution engine.
  • Screwdriver đź’˛ - Yahoo's OpenSource buildplatform designed for Continous Delivery.
  • Skipper - Easily dockerize your Git repository by @Stratoscale
  • SwarmCI - Create a distributed, isolated task pipeline in your Docker Swarm.
  • Watchtower - Automatically update running Docker containers

Development Environment

  • batect - build and testing environments as code tool: Dockerised build and testing environments made easy by @charleskorn
  • Binci - Containerize your development workflow. (formerly DevLab by @TechnologyAdvice)
  • Boot2Docker - Docker for OSX and Windows
  • construi - Run your builds inside a Docker defined environment by @lstephen
  • Crashcart - Sideload Linux binaries into a running container for troubleshooting by @Oracle
  • dde 🚧 - Local development environment toolset based on Docker. By @whatwedo
  • Devstep đź’€ - Development environments powered by Docker and buildpacks by @fgrehm
  • Dinghy - An alternative way to use Docker on Mac OS X using Docker Machine with virtualbox, vmware, xhyve or parallels
  • DIP - CLI utility for straightforward provisioning and interacting with an application configured by docker-compose. By @bibendi
  • DLite đź’€ - Simplest way to use Docker on OSX, no VM needed. By @nlf
  • dobi - A build automation tool for Docker applications. By @dnephin
  • DockerBuildManagement - Build Management is a python application, installed with pip. The application makes it easy to manage a build system based on Docker by configuring a single yaml file describing how to build, test, run or publish a containerized solution.
  • Docker Missing Tools - A set of bash commands to shortcut typical docker dev-ops. An alternative to creating typical helper scripts like "build.sh" and "deploy.sh" inside code repositories. By @NandoQuintana.
  • Docker osx dev đź’€ - A productive development environment with Docker on OS X by @brikis98
  • Docker-Arch - Generate Web/CLI projects Dockerized development environments, from 1 simple YAML file. By @Ph3nol
  • Docker-sync - Drastically improves performance (50-70x) when using Docker for development on Mac OS X/Windows and Linux while sharing code to the container. By @EugenMayer
  • docker-vm - Simple and transparent alternative to boot2docker (backed by Vagrant) by @shyiko
  • Dusty - Managed Docker development environments on OS X
  • Eclipse Che - Developer workspace server with Docker runtimes, cloud IDE, next-generation Eclipse IDE
  • EnvCLI - Replace your local installation of Node, Go, ... with project-specific docker containers. By @EnvCLI
  • footloose - Spin containers that look like Virtual Machines - By @dlespiau
  • forward2docker đź’€ - Utility to auto forward a port from localhost into ports on Docker containers running in a boot2docker VM by @bsideup
  • Gebug - A tool that makes debugging of Dockerized Go applications super easy by enabling Debugger and Hot-Reload features, seamlessly.
  • Lando - Lando is for developers who want to quickly specify and painlessly spin up the services and tools needed to develop their projects. By Tandem
  • Vagga - Vagga is a containerisation tool without daemons. It is a fully-userspace container engine inspired by Vagrant and Docker, specialized for development environments by @tailhook
  • Zsh-in-Docker - Install Zsh, Oh-My-Zsh and plugins inside a Docker container with one line! By Deluan

Garbage Collection

Serverless

  • AMP đź’€ - The open source unified CaaS/FaaS platform for Docker, batteries included. By @Appcelerator
  • Apache OpenWhisk - a serverless, open source cloud platform that executes functions in response to events at any scale. By @apache
  • Docker-Lambda - Docker images and test runners that replicate the live AWS Lambda environment. By @lamb-ci
  • Funker - Functions as Docker containers example voting app. By @bfirsh
  • IronFunctions - The serverless microservices platform FaaS (Funcitons as a Service) which uses Docker containers to run Any language or AWS Lambda functions
  • OpenFaaS - A complete serverless functions framework for Docker and Kubernetes. By OpenFaaS
  • SCAR - Serverless Container-aware Architectures (SCAR) is a serverless framework that allows easy deployment and execution of containers (e.g. Docker) in Serverless environments (e.g. Lambda) by @grycap

Testing

  • Container Structure Test - A framework to validate the structure of an image by checking the outputs of commands or the contents of the filesystem. By @GoogleContainerTools
  • dgoss - A fast YAML based tool for validating docker containers.
  • DockerSpec - A small Ruby Gem to run RSpec and Serverspec, Infrataster and Capybara tests against Dockerfiles or Docker images easily. By @zuazo
  • Dockunit đź’€ - Docker based integration tests. A simple Node based utility for running Docker based unit tests. By @dockunit
  • InSpec - InSpec is an open-source testing framework for infrastructure with a human- and machine-readable language for specifying compliance, security and policy requirements. By @chef
  • Pull Dog - A GitHub app that automatically creates Docker-based test environments for your pull requests, from your docker-compose files. Not open source.
  • Pumba - Chaos testing tool for Docker. Can be deployed on kubernetes and CoreOS cluster. By @alexei-led

Wrappers

  • Ansible - Manage the life cycle of Docker containers. By RedHat
  • Azk - Orchestrate development environments on your local machine by @azukiapp
  • Beluga đź’€ - CLI to deploy docker containers on a single server or low amount of servers. By @cortextmedia
  • dexec - Command line interface written in Go for running code with Docker Exec images.
  • dockerized - Seamlessly execute commands in a container.
  • Dray - An engine for managing the execution of container-based workflows by @CenturyLinkLabs
  • FuGu đź’€ - Docker run wrapper without orchestration by @mattes
  • Shutit - Tool for building and maintaining complex Docker deployments by @ianmiell
  • subuser - Makes it easy to securely and portably run graphical desktop applications in Docker
  • T.A.D.S. boilerplate - The power of Ansible and Terraform + the simplicity of Docker Swarm = Infrastructure as Code and DevOps best practices. By @Thomvaill
  • Turbo - Simple and Powerful utility for docker. By @ramitsurana
  • udocker - A tool to execute simple docker containers in batch or interactive systems without root privileges by @inidigo-dc
  • Vagrant - Docker provider - Good starting point is vagrant-docker-example by @bubenkoff

Services based on Docker (:heavy_dollar_sign:)

CI Services

  • CircleCI đź’˛ - Push or pull Docker images from your build environment, or build and run containers right on CircleCI.
  • CodeFresh đź’˛ - Everything you need to build, test, and share your Docker applications. Provides automated end to end testing.
  • CodeShip đź’˛ - Work with your established Docker workflows while automating your testing and deployment tasks with our hosted platform dedicated to speed and security.
  • ConcourseCI đź’˛ - A CI SaaS platform for developers and DevOps teams pipeline oriented.
  • Semaphore CI đź’˛ — A high-performance cloud solution that makes it easy to build, test and ship your containers to production.
  • Shippable đź’˛ - A SaaS platform for developers and DevOps teams that significantly reduces the time taken for code to be built, tested and deployed to production.
  • TravisCI đź’˛ - A Free github projects continuous integration Saas platform for developers and Devops.

CaaS

  • Amazon ECS đź’˛ - A management service on EC2 that supports Docker containers.
  • Azure AKS đź’˛ - Simplify Kubernetes management, deployment, and operations. Use a fully managed Kubernetes container orchestration service.
  • Cloud 66 đź’˛ - Full-stack hosted container management as a service
  • Codenvy đź’˛ - One-click Docker environments and cloud workspace for development teams
  • Dockhero đź’˛ - Dockhero is a Heroku add-on which turns a Docker image into a microservice attached to the Heroku app. Currently in beta.
  • Giant Swarm đź’˛ - Simple microservice infrastructure. Deploy your containers in seconds.
  • Google Container Engine đź’˛ - Docker containers on Google Cloud Computing powered by Kubernetes.
  • Jelastic Cloud đź’˛ - "Easy-to-use" container hosting platfrom with automatic vertical and horizontal scaling. Available over 50+ hosting providers worldwide.
  • Mesosphere DC/OS Platform đź’˛ - Integrated platform for data and containers built on Apache Mesos by @mesosphere
  • OpenShift Dedicated đź’˛ - A hosted OpenShift cluster for running your Docker containers managed by Red Hat.
  • Sloppy.io đź’˛ - all-in-one solution for container deployment and hosting – made and hosted in Germany
  • Triton đź’˛ - Elastic container-native infrastructure by Joyent.

Monitoring Services

  • AppDynamics đź’˛ - AppDynamics gives enterprises real-time insights into application performance, user performance, and business performance so they can move faster in an increasingly sophisticated, software-driven world.
  • Axibase Time-Series Database đź’˛ - Long-term retention of container statistics and built-in dashboards for Docker. Collected with native Google cAdvisor storage driver.
  • Broadcom Docker Monitoring đź’˛ - Agile Operations solutions from Broadcom deliver the modern Docker monitoring businesses need to accelerate and optimize the performance of microservices and the dynamic Docker environments running them. Monitor both the Docker environment and apps that run inside them. (former CA Technologies)
  • Collecting docker logs and stats with Splunk
  • Datadog đź’˛ - Datadog is a full-stack monitoring service for large-scale cloud environments that aggregates metrics/events from servers, databases, and applications. It includes support for Docker, Kubernetes, and Mesos.
  • Prometheus đź’˛ - Open-source service monitoring system and time series database
  • Site24x7 đź’˛ - Docker Monitoring for DevOps and IT is a SaaS Pay per Host model
  • SPM for Docker đź’˛ - Monitoring of host and container metrics, Docker events and logs. Automatic log parser. Anomaly Detection and alerting for metrics and logs. @sematext
  • Sysdig Monitor đź’˛ - Sysdig Monitor can be used as either software or a SaaS service to monitor, alert, and troubleshoot containers using system calls. It has container-specific features for Docker and Kubernetes.

Useful Resources

Awesome Lists

Demos and Examples

  • Webstack-micro Demo web app showing how Docker Compose might be used to set up an API Gateway, centralized authentication, background workers, and WebSockets as containerized services.
  • An Annotated Docker Config for Frontend Web Development A local development environment with Docker allows you to shrink-wrap the devops your project needs as config, making onboarding frictionless.

Good Tips

Raspberry Pi & ARM

Security

Videos

Communities and Meetups

Brazilian

Chinese

English

Russian

Spanish

Stargazers over time

Stargazers over time

======= npm version Build Status Coverage Status Known Vulnerabilities

IoC Container for Typescript - 3.X

This is a lightweight annotation-based dependency injection container for typescript.

It can be used on browser, on react native or on node.js server code.

The documentation for the previous version can be found here

Table of Contents

Installation

This library only works with typescript. Ensure it is installed:

npm install typescript -g

To install typescript-ioc:

npm install typescript-ioc

Configuration

Typescript-ioc requires the following TypeScript compilation options in your tsconfig.json file:

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "target": "es6" // or anything newer like esnext
  }
}

Basic Usage

import {Inject} from "typescript-ioc";

class PersonDAO {
  @Inject
  restProxy: PersonRestProxy;
}

That's it. You can just call now:

let personDAO: PersonDAO = new PersonDAO();

And the dependencies will be resolved.

You can also inject constructor parameters, like:

class PersonService {
  private personDAO: PersonDAO;
  constructor( @Inject personDAO: PersonDAO ) {
    this.personDAO = personDAO;
  }
}

and then, if you make an injection to this class, like...

class PersonController {
  @Inject
  private personService: PersonService;
}

The container will create an instance of PersonService that receives the PersonDAO from the container on its constructor. But you can still call:

let personService: PersonService = new PersonService(myPersonDAO);

And pass your own instance of PersonDAO to PersonService.

Note that any type with a constructor can be injected.

class PersonController {
  @Inject
  private personService: PersonService;

  @Inject
  creationTime: Date;
}

Inheritance

You don't have to do anything special to work with sub-types.

abstract class BaseDAO {
  @Inject
  creationTime: Date;
}

class PersonDAO extends BaseDAO {
  @Inject
  private personRestProxy: PersonRestProxy;
}

class ProgrammerDAO extends PersonDAO {
  @Inject
  private programmerRestProxy: PersonRestProxy;
}

The above example will work as expected.

Scopes

You can use scopes to manage your instances. We have three pre defined scopes (Scope.Singleton, Scope.Request and Scope.Local), but you can define your own custom Scope.

@Singleton

Allow just one instance for each type bound to this scope.

@Singleton 
class PersonService {
  @Inject
  private personDAO: PersonDAO;
}

class PersonController {
  @Inject
  private personService: PersonService;

  @Inject
  creationTime: Date;
}

So, we can create a lot of PersonController instances, but all of them will share the same singleton instance of PersonService

let controller1: PersonController = new PersonController();
let controller2: PersonController = new PersonController();

@InRequestScope

Types bound to this scope will share instances between the same build context. When you call Container.get, a new build context is created and every container resolution performed will share this context.

For example:

@InRequestScope
class RequestScopeClass {}

class FirstClass {
    @Inject
    public a: RequestScopeClass;
}

class SecondClass {
    @Inject
    public a: RequestScopeClass;
    @Inject
    public b: FirstClass;
}

In that example, we can expect:

const secondClass = Container.get(SecondClass);
expect(secondClass.a).toEqual(secondClass.b.a);

Local Scope

The container will create a new instance every time it will be asked to retrieve objects for types bound to the Local scope.

The Local scope is the default scope. So you don't need to configure nothing to work with a Local scope. However if you have a Type bound to other scope and want to change it to the Local scope, you can use the Scope.Local property:

@Singleton
class MyType {}

Container.bind(MyType).scope(Scope.Local);

Custom Scopes

To define a new scope, you just have to extend the Scope abstract class:

class MyScope extends Scope { 
  resolve(factory: ObjectFactory, source:Function, context: BuildContext) {
    console.log('created by my custom scope.')
    return factory(context);
  }
}
@Scoped(new MyScope()) 
class PersonService {
  @Inject
  private personDAO: PersonDAO;
}

Factories

Factories can be used to create the instances inside the IoC Container.

const personFactory: ObjectFactory = () => new PersonService(); 
@Factory(personFactory)
class PersonService {
  @Inject
  private personDAO: PersonDAO;
}

The Factory method will receive the BuildContext as parameter. So, if you need to retrieve another instance from the container to perform the factory instantiation, you can ask it to the BuildContext. For example:

const personFactory: ObjectFactory = (context) => new PersonService(context.resolve(PersonDAO)); 
@Factory(personFactory)
class PersonService {
  constructor(private personDAO: PersonDAO){}
}

The @OnlyInstantiableByContainer annotation

The @OnlyInstantiableByContainer annotation transforms the annotated class, changing its constructor. So, it will only be able to create new instances for the decorated class through to the IoC Container.

It is usefull, for example, to avoid direct instantiation of Singletons.

@Singleton 
@OnlyInstantiableByContainer 
class PersonService {
  @Inject
  private personDAO: PersonDAO;
}

If anybody try to invoke:

new PersonService();

Will prodeuce a TypeError.

The Container class

You can also bind types directly to Container resolution.

// it will override any annotation configuration
Container.bind(PersonDAO).to(ProgrammerDAO).scope(Scope.Local); 

// that will make any injection to Date to return 
// the same instance, created when the first call is executed.
Container.bind(Date).to(Date).scope(Scope.Singleton); 

// it will ask the IoC Container to retrieve the instance.
let personDAO = Container.get(PersonDAO); 
class PersonDAO {
  @Inject
  private personRestProxy: PersonRestProxy;
}

Container.bind(PersonDAO); 
let personDAO: PersonDAO = Container.get(PersonDAO); 
// or
let otherPersonDAO: PersonDAO = new PersonDAO(); 
// personDAO.personRestProxy is defined. It was resolved by Container.
@OnlyInstantiableByContainer
@Singleton
class PersonDAO {
}

let p: PersonDAO = new PersonDAO(); // throws a TypeError.  classes decorated with @OnlyInstantiableByContainer can not be instantiated directly

const personFactory: ObjectFactory = () => new PersonDAO();
Container.bind(PersonDAO).factory(personFactory); //Works OK

let personDAO = Container.get(PersonDAO); // Works OK

@InjectValue decorator and Constants

It is possible to bind constants to the Container. It is useful for configurations, for example.

interface Config {
    dependencyURL: string;
    port: number;
}

Container.bindName('config').to({
    dependencyURL: 'http://localhost:8080',
    port: 1234
});

And then you can use the @InjectValue decorator exactly as you use @Inject to inject instances.

class MyService {
    constructor(@InjectValue('config') public config: Config) { }
}

It is possible to inject an internal property from a constant, like:

class MyService {
    constructor(@InjectValue('config.dependencyURL') private url: string,
                @InjectValue('myConfig.otherProperty.item[0].otherURL') private otherURL: string) { }
}

And also to mix constants and other container injections, like:

class MyService {
    constructor(@InjectValue('config.dependencyURL') private url: string,
                @InjectValue('myConfig.otherProperty.item[0].otherURL') private otherURL: string, 
                @Inject private myRepository: MyRepository) { }
}

Value Injections can be used direclty in class properties:

class MyService {
    @InjectValue('config.dependencyURL') 
    private url: string;
    
    @InjectValue('myConfig.otherProperty.item[0].otherURL') 
    private otherURL: string;
    
    @Inject 
    private myRepository: MyRepository;
}

Or read directly from the Container:

const url: string = Container.getValue('config.dependencyURL');

It is possible to bind an internal property of a constant, like:

Container.bindName('config.dependencyURL').to('http://anewURL.com');

Namespaces (Environments)

It is possible to create specific namespaces with custom configurations and then tell container to use these namespaces.

For example:

Container.bindName('config.dependencyURL').to('http://myURL.com');
const namespace = Container.namespace('test');
Container.bindName('config.dependencyURL').to('http://anewURL.com');

Only if the namespace 'test' is active, the 'config.dependencyURL' will resolve to 'http://anewURL.com'.

To use the default namespace, just call Container.namespace(null).

If you want to remove a namespace, just call namespace.remove()

const namespace = Container.namespace('test');
namespace.remove();

It is not possible to remove the default namespace.

An alias called 'environment' is defined for the namespace method:

Container.namespace('test');
Container.environment('test'); // both commands are equivalents

Take a look at here for more examples of namespaces usage.

Creating temporary configurations

You can use snapshot for testing or where you need to temporarily override a binding.

describe('Test Service with Mocks', () => {

    const snapshot: Snapshot;
    before(function () {
        // Store the IoC configuration
        snapshot = Container.snapshot();
        
        // Change the IoC configuration to a mock service.
        Container.bind(IService).to(MockService);
    });

    after(function () {
        // Put the IoC configuration back for IService, so other tests can run.
        snapshot.restore();
    });

    it('Should do a test', () => {
        // Do some test
    });
});

Importing configurations from external file

You can put all manual container configurations in an external file and then use the '''Container.configure''' method to import them.

For example, you can create the ioc.config.ts file:

import { MyType, MyTypeImpl, MyType2, MyType2Factory } from './my-types';
import { Scope } from 'typescript-ioc';
import * as yaml from 'js-yaml';
import * as fs from 'fs';

const config = yaml.safeLoad(fs.readFileSync('service-config.yml', 'utf8'));

export default [
  { bind: MyType, to: MyTypeImpl },
  { 
    bind: MyType2, 
    factory: MyType2Factory, 
    withParams: [Date], 
    scope: Scope.Singleton 
  },
  { bindName: 'config', to: config }
];

And then import the configurations using:

import { Container } from "typescript-ioc";
import config from './ioc.config';

Container.configure(config);

You need to load the configurations only once, but before you try to use the objects that depends on these files.

You can create configurations for specific namespaces, like:

import { MyRepository, MyTestRepository } from './my-types';
import * as yaml from 'js-yaml';
import * as fs from 'fs';

const config = yaml.safeLoad(fs.readFileSync('service.config.yml', 'utf8'));
const configTest = yaml.safeLoad(fs.readFileSync('service.config-test.yml', 'utf8'));
const configProd = yaml.safeLoad(fs.readFileSync('service.config-prod.yml', 'utf8'));

export default [
  { bindName: 'config', to: config },
  { namespace: {
      test: [
        { bindName: 'config', to: configTest },
        { bind: MyRepository, to: MyTestRepository },
      ],
      production: [
        { bindName: 'config', to: configProd }
      ]
    }
  }
];

A note about classes and interfaces

Typescript interfaces only exist at development time, to ensure type checking. When compiled, they do not generate runtime code. This ensures good performance, but also means that is not possible to use interfaces as the type of a property being injected. There is no runtime information that could allow any reflection on interface type. Take a look at microsoft/TypeScript#3628 for more information about this.

So, this is not supported:

interface PersonDAO {
  get(id: string): Person;
}

class ProgrammerDAO implements PersonDAO {
  @Inject
  private programmerRestProxy: PersonRestProxy;

  get(id: string): Person
  {
      // get the person and return it...
  }
}

Container.bind(PersonDAO).to(ProgrammerDAO); // NOT SUPPORTED

class PersonService {
  @Inject // NOT SUPPORTED
  private personDAO: PersonDAO;
}

However there is no reason for panic. Typescript classes are much more than classes. It could have the same behavior that interfaces on other languages.

So it is possible to define an abstract class and then implement it as we do with interfaces:

abstract class PersonDAO {
  abstract get(id: string): Person;
}

class ProgrammerDAO implements PersonDAO {
  @Inject
  private programmerRestProxy: PersonRestProxy;

  get(id: string): Person
  {
      // get the person and return it...
  }
}

Container.bind(PersonDAO).to(ProgrammerDAO); // It works

class PersonService {
  @Inject // It works
  private personDAO: PersonDAO;
}

The abstract class in this example has exactly the same semantic that the typescript interface on the previous example. The only difference is that it generates type information into the runtime code, making possible to implement some reflection on it.

Examples

Using Container for testing

Some examples of using the container for tests:

describe('My Test', () => {
    let myService: MyService;
    beforeAll(() => {
        class MockRepository implements AuthenticationRepository {
          async getAccessToken() {
            return 'my test token';
          }
        }
        Container.bind(AuthenticationRepository).to(MockRepository)
        myService = Container.get(MyService);
    });
    //...
});

or you can configure all your mocks togheter in a mocks.config.ts

class MockRepository implements AuthenticationRepository {
  async getAccessToken() {
    return 'my test token';
  }
}

class OtherMockRepository implements OtherRepository {
  async doSomething() {
    return 'done';
  }
}

export default [
  { bind: AuthenticationRepository, to: MockRepository },
  { bind: OtherRepository, to: OtherMockRepository }
];

and then in your test files:

import mocksConfig from './mocks.config.ts';

describe('My Test', () => {
    let myService: MyService;
    beforeAll(() => {
        Container.config(mocksConfig);
        myService = Container.get(MyService);
    });
    //...
});

or if you want to use the configurations and restore the container after the test:

import mocksConfig from './mocks.config.ts';

describe('My Test', () => {
    let myService: MyService;
    let snaphot: Snaphot;
    beforeAll(() => {
        snapshot = Container.snapshot();
        Container.config(mocksConfig);
        myService = Container.get(MyService);
    });

    afterAll(() => {
        snapshot.restore();
    });

    //...
});

Using Namespaces

Define configurations on a file, like ioc.config.ts:

import { MyRepository, MyTestRepository } from './my-types';
import * as yaml from 'js-yaml';
import * as fs from 'fs';

const config = yaml.safeLoad(fs.readFileSync('service.config.yml', 'utf8'));
const configTest = yaml.safeLoad(fs.readFileSync('service.config-test.yml', 'utf8'));
const configProd = yaml.safeLoad(fs.readFileSync('service.config-prod.yml', 'utf8'));

export default [
  { bindName: 'config', to: config },
  { env: {
      test: [
        { bindName: 'config', to: configTest },
        { bind: MyRepository, to: MyTestRepository },
      ],
      production: [
        { bindName: 'config', to: configProd }
      ]
    }
  }
];

And then import the configurations using:

import { Container } from "typescript-ioc";
import config from './ioc.config';

Container.configure(config);
// Then activate the environment calling the container 
Container.environment(process.env.NODE_ENV);

Browser usage

It was tested with browserify and webpack, but it should work with any other similar tool.

Starting from version 2, this library only works in browsers that supports javascript ES6 '''class'''. If you need to support old ES5 browsers, please use the version 1.2.6 of this library

Restrictions

  • Circular injections are not supported

Migrating from previous version

Some breaking changes:

ES6 suport

This library does not support old ES5 code anymore. So, you need to change the target compilation of your code to es6 (or anything else newer, like es2016, es2020, esnext etc)

Your tsconfig.json needs to include at least:

{
   "compilerOptions": {
       "experimentalDecorators": true,
       "emitDecoratorMetadata": true,
       "target": "es6"
   }
}

This decision was taken to help to solve a lot of bugs with react native and browser environments.

If you need to support es5 code, you can keep using the 1.2.6 version

@AutoWired renamed

A lot of confusion with @AutoWired motivated us to rename it to @OnlyInstantiableByContainer. It is a big name, but it says exactly what that decorator does. It is completely optional (The container will always work in the same way when instrumenting the types), but it transforms the decorated constructor to avoid that anybody create new instances calling direct a new expression.

So you need to change all references to @AutoWired to @OnlyInstantiableByContainer.

@Provided @Provides and Provider interface removed

We changed the name of the interface Provider to ObjectFactory and also change the definition of this type to be a simple function signature.

So, now we have:

// previous version
const provider = {
  get: () => new MyType()
};

// new version
const factory = () => new MyType();

Following the same design, whe renamed the @Provideddecorator to @Factory.

// previous version
@Provided({
  get: () => new MyType()
})
class MyType {
}

// new version
@Factory(() => new MyType())
class MyType {
}

The @Provides decorator was removed because it could cause a lot of problems, once it was used in the class that would provide an implementation, that usually was always defined in different files. That forced us to had things like ContainerConfig.addSource() to scan folders for files. It caused problems in react native, in browser and in some environments like lambda functions.

We redesigned a new way to load container configurations that does not need to scan folders anymore, removing the problems and improving the performance. Take a look at Container.configure method for a better option for the old @Provides.

Container.snapshot refactored

We had a minor change in the Snapshot handling. We don't have anymore the public method Container.restore(type). A safer way to work with snapshots was implemented. Now the Container.snapshot method returns a snapshot object. That object has a restore() method.

The new way:

const snapshot = Container.snapshot();
snapshot.restore();

SonjayaJetBrain-patch-1