Dock2Sing
A Python-based tool for converting Docker Compose configurations to Singularity Compose format, with built-in validation and guidance.
Overview
This tool helps users migrate their Docker Compose configurations to Singularity Compose format, which is particularly useful in HPC (High-Performance Computing) environments where Singularity is the preferred container runtime. The tool includes a validation component that helps identify potential issues and provides guidance for the conversion process.
Features
- Converts Docker Compose services to Singularity instances
- Handles key Docker Compose features:
- Container images
- Volume mounts
- Environment variables
- Port mappings
- Working directories
- Service dependencies
- Provides detailed validation of converted configurations
- Offers guidance for handling unsupported features
- Includes colored terminal output for better readability
- Supports comparison with original Docker Compose file
Requirements
- Python 3.12 or higher
- Poetry for dependency management
- Singularity installed on the target system
Installation
- Clone the repository:
git clone https://github.com/labadorf/dock2sing.git
cd dock2sing
- Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
- Install the project and its dependencies:
poetry install
Usage
Converting Docker Compose to Singularity Compose
poetry run dock2sing docker-compose.yml [-o singularity-compose.yml]
Options:
docker-compose.yml: Path to your Docker Compose file (required)-o, --output: Path for the output Singularity Compose file (optional, defaults tosingularity-compose.yml)
Validating Singularity Compose Configuration
poetry run validate-singularity singularity-compose.yml [-d docker-compose.yml]
Options:
singularity-compose.yml: Path to your Singularity Compose file (required)-d, --docker: Path to the original Docker Compose file for comparison (optional)
Development
This project uses several development tools to maintain code quality:
pytestfor testingblackfor code formattingisortfor import sortingflake8for linting
To set up the development environment:
poetry install --with dev
To run tests:
poetry run pytest
To format code:
poetry run black .
poetry run isort .
Important Notes
Feature Compatibility
Some Docker features have different implementations or limitations in Singularity:
-
Networking:
- Singularity networking works differently from Docker
- Custom networks need manual configuration
- Port mappings may require additional setup
-
Volumes:
- Named volumes need manual configuration
- Volume paths should be absolute
- Bind mounts work differently in Singularity
-
User Permissions:
- Singularity containers run with user permissions by default
- Root access requires special configuration
- User namespace handling differs from Docker
-
Unsupported Features:
- Healthchecks
- Secrets
- Configs
- Deploy configurations
Best Practices
- Always validate your converted configuration
- Test each container individually before running the full setup
- Review the validation warnings and address them appropriately
- Consider using Singularity definition files for custom container builds
- Use absolute paths for volume mounts
- Test thoroughly in your target environment
Example
Input Docker Compose File
version: '3'
services:
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./data:/usr/share/nginx/html
environment:
- DEBUG=1
Output Singularity Compose File
version: '1.0'
instances:
web:
container: docker://nginx:latest
ports:
- "80:80"
volumes:
- ./data:/usr/share/nginx/html
environment:
DEBUG: "1"
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Docker Compose team for the original specification
- Singularity team for the container runtime
- Contributors and users of this tool
Metadata
Release files for dock2sing 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dock2sing-1.0.0.tar.gz | 6.8 kB | Without provenance | Details for dock2sing-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dock2sing-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for dock2sing-1.0.0-py3-none-any.whl |
Total release size: 15.7 kB
Release files / dock2sing-1.0.0.tar.gz
| Download URL | dock2sing-1.0.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8de066bef3fe9e58e252274d8e2a52d59d52a2db03b5247edd84452a43dedbeb
|
|
BLAKE2b-256 checksum How to use checksums |
9defcb3699e58061caa4774159b7be2efcce81d14eefd810383f10c3d476b0b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Linux/6.13.7-200.fc41.x86_64
|
Release files / dock2sing-1.0.0-py3-none-any.whl
| Download URL | dock2sing-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca4791d3b65432f2a2883399808d73906a1f8a3c3bbc5e08ae0131602a14a349
|
|
BLAKE2b-256 checksum How to use checksums |
899e66ea54858cf965dfbc6470902ca3beca61f8b172a7cc469e1d28b6f4a705
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Linux/6.13.7-200.fc41.x86_64
|
Security for dock2sing 1.0.0
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.