{"id":13498094,"url":"https://github.com/merll/docker-map","last_synced_at":"2025-03-28T22:32:19.434Z","repository":{"id":20126798,"uuid":"23396792","full_name":"merll/docker-map","owner":"merll","description":"Managing Docker images, containers, and their dependencies in Python.","archived":true,"fork":false,"pushed_at":"2020-04-30T22:18:09.000Z","size":1469,"stargazers_count":74,"open_issues_count":2,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-02T19:05:29.377Z","etag":null,"topics":["docker","docker-configurations","docker-containers","dockerfile","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/merll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-27T16:20:03.000Z","updated_at":"2023-08-18T00:39:51.000Z","dependencies_parsed_at":"2022-08-30T10:50:20.719Z","dependency_job_id":null,"html_url":"https://github.com/merll/docker-map","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merll%2Fdocker-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merll%2Fdocker-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merll%2Fdocker-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merll%2Fdocker-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merll","download_url":"https://codeload.github.com/merll/docker-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222426399,"owners_count":16982673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-configurations","docker-containers","dockerfile","python"],"created_at":"2024-07-31T20:00:50.525Z","updated_at":"2024-10-31T14:31:23.172Z","avatar_url":"https://github.com/merll.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Docker-Map\n==========\n\nManaging Docker images, containers, and their dependencies in Python.\n---------------------------------------------------------------------\n\nProject: https://github.com/merll/docker-map\n\nDocs: https://docker-map.readthedocs.io/en/latest/\n\n\nOverview\n========\nThis package provides tools for building Docker images, create containers,\nconnect dependent resources, and run them in development as well as production\nenvironments.\n\nThe library builds on functionality of the Docker Remote API client for Python,\n`docker-py`. Its main target is to reduce the repetitive and error-prone code that is\nrequired for creating and connecting containers in a non-trivial stack. It can be used\nstandalone for custom orchestration or for enhancing available deployment / remote\nexecution utilities (see [Docker-Fabric](https://github.com/merll/docker-fabric),\n[Salt Container-Map](https://github.com/merll/salt-container-map)).\n\nContainers and their dependencies are configured object-based, through Python dictionaries,\nor YAML files.\n\nBuilding images\n===============\nWriting Dockerfiles is not hard. However, it only allows for using variable context to a\nlimited extent. For example, you may want to re-define directory paths in your project,\nwithout having to adjust it in multiple places; or you keep frequently reoccurring tasks\n(e.g. creating system user accounts) in your Dockerfile, and would like to use templates\nrather than copy \u0026 paste.\n\nDockerfiles\n-----------\nA `DockerFile` object generates a Dockerfile, that can either be saved locally or sent\noff to Docker through the remote API. Supports common commands such as `addfile` (`ADD`)\nor `run`, but also formats `CMD` and `ENTRYPOINT` appropriately for running a shell or\nexec command.\n\nDocker file context\n-------------------\n`DockerContext` generates a Docker context tarball, that can be sent to the remote API.\nIts main purpose is to add files from `DockerFile` automatically, so that the Dockerfile\nand the context tarball are consistent.\n\n\nCreating, connecting, and running containers\n============================================\nThis package reduces repetitions of names and paths in API commands, by introducing the\nfollowing main features:\n\n* Automatically create, configure, and assign shared volumes.\n* Automatically update containers if their shared volumes are inconsistent, their image,\n  or their configuration has been updated.\n* Use alias names instead of paths to bind host volumes to container shares.\n* Automatically create and start containers when their dependent containers are started.\n\nContainer configuration\n-----------------------\n`ContainerConfiguration` objects keep the elements of a configured container. Their main\nelements are:\n\n* `image`: Docker image to base the container on (default is identical to container name).\n* `clients`: Optional list of clients to run the identical container configuration on.\n* `instances`: Can generate multiple instances of a container with varying host mappings;\n  by default there is one main instance of each container.\n* `shares`: Volumes that are simply shared by the container, only for the purpose of\n  keeping data separate from the container instance, or for linking the entire container\n  to another.\n* `binds`: Host volume mappings. Uses alias names instead of directory paths.\n* `uses`: Can be names of other containers, or volumes shared by another volume through\n  `attaches`. Has the same effect as the `volumes_from` argument in the API, but using alias\n  names and automatically resolving these to paths.\n* `links`: For container linking. Container names are translated to instance name on the map.\n* `attaches`: Generates a separate container for the purpose of sharing data with another\n  one, assigns file system permissions as set in `permissions` and `user`. This makes\n  configuration of sockets very easy.\n* `exposes`: Configures port bindings for linked containers and on host interfaces.\n* `exec_commands`: Launches commands on containers after they have been created and started.\n* `create_options` and `host_config` provide the possibility to add further keyword\n  arguments such as `command` or `entrypoint`, which are passed through to the `docker-py`\n  client.\n\nContainer maps\n--------------\n`ContainerMap` objects contain three sets of elements:\n\n1. Container names, each associated with a `ContainerConfiguration`.\n2. Volumes, mapping shared directory paths to alias names.\n3. Host shares, mapping host directory paths to alias names.\n\nClients, as defined in a `ContainerConfiguration`, can also be set globally on map level.\n\n`ContainerConfiguration` instances and their elements can be created and used in a\ndictionary-like or attribute syntax, e.g.\n`container_map.containers.container_name.uses` or\n`container_map.containers['container_name']['uses']`.\nVolume aliases are stored in `container_map.volumes` and host binds in\n`container_map.host`; they support the same syntax variations as containers.\n\nClient configuration\n--------------------\n`ClientConfiguration` objects allow for a host-specific management of parameters, such as\nservice URL and timeout. For example, the `interfaces` property translates the `exposes`\nsetting for a configuration on each host into a port binding argument with the local\naddress.\n\nCombining the elements\n----------------------\n`MappingDockerClient` applies one or multiple `ContainerMap` instances to one or\nmultiple Docker clients. A container on the map can easily be created with all its\ndependencies by running `client.create('container_name')`.\n\nRunning the container can be as easy as\n`client.start('container_name')`\nor can be enhanced with custom parameters such as\n`client.start('container_name', expose={80: 80})`.\n\nIf all configuration is stored on the map, creation and start are combined in\n`client.startup('container_name')`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerll%2Fdocker-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerll%2Fdocker-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerll%2Fdocker-map/lists"}