Using b with Docker
b provides official Docker images that make it easy to use binary management in containerized environments without installing b locally.
Docker Images
The official Docker images are available at ghcr.io/fentas/b
with support for both AMD64 and ARM64 architectures.
Quick Usage
Volume Mounting
The key to using b with Docker is properly mounting your binary directory:
- Host path:
./.bin
(your local binary directory) - Container path:
/.bin
(where b expects to find/install binaries)
Environment Variables
You can also use environment variables to control where b installs binaries:
Using in Your Own Dockerfiles
Multi-stage Copy
Copy the b binary from the official image into your own containers:
CI/CD Integration
Use b in your CI/CD pipelines with Docker:
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install project tools with b
run: |
docker run --rm -v ./.bin:/.bin ghcr.io/fentas/b install jq kubectl
- name: Add tools to PATH
run: echo "${{ github.workspace }}/.bin" >> $GITHUB_PATH
- name: Use installed tools
run: |
kubectl version --client
jq --version
Docker Compose
Integrate b into your Docker Compose workflows:
Available Tags
ghcr.io/fentas/b:latest
- Latest stable version (multi-arch)ghcr.io/fentas/b:v4.3.0
- Specific version (multi-arch)ghcr.io/fentas/b:latest-amd64
- AMD64 specificghcr.io/fentas/b:latest-arm64
- ARM64 specific
Best Practices
1. Use Volume Mounts
Always mount your binary directory to persist installed tools:
2. Pin Versions in Production
Use specific image tags in production environments:
3. Set Environment Variables
Explicitly set PATH_BIN when using custom installation directories:
Troubleshooting
Permission Issues
If you encounter permission issues with volume mounts:
Binary Not Found
Ensure your PATH includes the binary directory:
Environment Configuration
If b fails to install, ensure environment variables are set: