Skip to content

Run BlackD in Docker

Dockerfile
FROM python:3.12-slim

WORKDIR /

RUN pip install black[d]

EXPOSE 45484
CMD ["blackd", "--bind-host", "0.0.0.0", "--bind-port", "45484"]
bash
docker build -t blackd:latest .
docker run -d -p 45484:45484 black

Bonus

Push to github registry

bash
docker login --username olivierargentieri ghcr.io
docker build . -t ghcr.io/olivierargentieri/blackd-ghcr:latest
docker push ghcr.io/olivierargentieri/blackd-ghcr:latest