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 --version

Available Tags

  • latest - Latest stable release

  • v0.1.0, v0.2.0, etc. - Specific version tags

  • main - 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-bit

  • linux/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

  1. SSH Keys: Always mount SSH keys as read-only (:ro)

  2. User Isolation: The container runs as non-root user ansibleinspec

  3. Network: Consider using --network=host if needed for local testing

  4. Secrets: Use Docker secrets or environment files for sensitive data

CI/CD Integration

GitHub Actions

GitLab CI

Performance Tips

  1. Use volumes for caching:

  2. Reduce image pulls with specific tags:

  3. 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