Docker Usage
Ansible-InSpec is available as a Docker image for easy deployment and isolation.
Quick Start
# Pull the latest image
docker pull htunnthuthu/ansible-inspec:latest
# Run with --help
docker run --rm htunnthuthu/ansible-inspec:latest --help
# Check version
docker run --rm htunnthuthu/ansible-inspec:latest --versionAvailable Tags
latest- Latest stable releasev0.1.0,v0.2.0, etc. - Specific version tagsmain- Latest development build (if available)
Common Usage Patterns
Initialize a New InSpec Profile
Execute InSpec Tests Against Infrastructure
Mount SSH Keys for Remote Connections
Save Results to Host
Docker Compose Example
Create a docker-compose.yml:
Run with:
Building Custom Images
If you need to customize the image:
Multi-Architecture Support
Images are built for:
linux/amd64- Intel/AMD 64-bitlinux/arm64- ARM 64-bit (Apple Silicon, ARM servers)
Docker will automatically pull the correct architecture for your platform.
Environment Variables
Troubleshooting
Permission Issues
If you encounter permission errors with mounted volumes:
SSH Connection Issues
Ensure SSH keys have correct permissions:
Debugging
Run with interactive shell:
Security Considerations
SSH Keys: Always mount SSH keys as read-only (
:ro)User Isolation: The container runs as non-root user
ansibleinspecNetwork: Consider using
--network=hostif needed for local testingSecrets: Use Docker secrets or environment files for sensitive data
CI/CD Integration
GitHub Actions
GitLab CI
Performance Tips
Use volumes for caching:
Reduce image pulls with specific tags:
Multi-stage builds are already optimized in the official image
Support
For issues with Docker images:
GitHub Issues: https://github.com/Htunn/ansible-inspec/issues
Docker Hub: https://hub.docker.com/r/htunnthuthu/ansible-inspec
Last updated