Skip to main content

Docker Context

Run containers using with statement.

Example

import unittest
from urllib import request

from dockercontext import container


class ContextTest(unittest.TestCase):

    def test_response(self):
        with container.Context("nginx:alpine", {"80/tcp": 8080}):
            with request.urlopen("http://localhost:8080/") as response:
                self.assertEqual(response.code, 200)

    def test_container_id(self):
        with container.Context("nginx:alpine", {}) as ctx:
            self.assertEqual(64, len(ctx.container_id()))

        self.assertEqual(0, len(ctx.container_id()), ctx.container_id())

Note that although context blocks until container's state is running this does not meant that service inside container is ready.

Tests

$ python -m unittest

Metadata

Release files for dockercontext 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dockercontext 0.1
File Size Uploaded Provenance Actions
dockercontext-0.1.tar.gz 2.7 kB Without provenance Details for dockercontext-0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dockercontext 0.1
File Interpreter ABI Platform Actions
dockercontext-0.1-py3-none-any.whl Python 3 none any Details for dockercontext-0.1-py3-none-any.whl

Total release size: 6.9 kB

Release files / dockercontext-0.1.tar.gz

Download URL dockercontext-0.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ebfd65d48227404318125dca1bad5336e9152a8b179cc6ff4f4993d2939ec5a0
BLAKE2b-256 checksum
How to use checksums
9a6d70444a898fc40fc660600197fff2484611ffe9aabe505d2926d667b88b4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / dockercontext-0.1-py3-none-any.whl

Download URL dockercontext-0.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39edd52a02e2b9cd9fc7574b9998efb556a0fb46510945c31c0b866b87a86178
BLAKE2b-256 checksum
How to use checksums
e795604e92141ba7e2484f0c542625bb22ed07c591122c35465218f8403c2366
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Security for dockercontext 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page