Skip to main content

A wrapper for docker-compose that adds a network to all services.

Project description

Docker Network Integration Script (ncomp)

Overview

This script is designed to streamline the process of integrating a custom network into Docker Compose services. It automates the task of adding a specified network to all services in a Docker Compose file and ensures the network is properly defined and recognized by Docker Compose.

Features

  • Automatic Network Creation: Creates a Docker network if it does not already exist.
  • Dynamic Network Integration: Adds a specified network to all services in a Docker Compose file.
  • Custom Network Support: Supports custom network names as specified by the user environment.
  • Error Handling: Provides error output if the Docker Compose process encounters issues.

Requirements

  • Python 3.x
  • Docker Python SDK
  • PyYAML

Environment Variables

  • SHARED_NETWORK: The name of the network to be integrated into Docker Compose services. Default is "shared_network".
  • COMPOSE_FILE: The path to the Docker Compose file. Default is "docker-compose.yml".

Usage

  1. Set Environment Variables (optional): Define SHARED_NETWORK and COMPOSE_FILE if you want to use custom values.
  2. Run the Script: Execute the script in the same directory as your Docker Compose file or specify the path using the COMPOSE_FILE environment variable.

Example

# Run with custom network name and Docker Compose file
SHARED_NETWORK=my_network COMPOSE_FILE=my_docker_compose.yml ncomp up

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ncomp-0.1.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

ncomp-0.1.0-py2.py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page