How to use the cryptographic library package cryptography from a Docker Python image. As of May 26, 2016.
https://github.com/pyca/cryptography
pip install cryptography
Dockerfile
FROM python:3-slim
RUN pip install cryptography
As of May 26, 2016, this doesn't work because the dependent module cffi is not provided with wheel.
DOs For Debian base.
Dockerfile
FROM python:3-slim
RUN apt install python-cffi && pip install cryptography
If it is jessie, cffi 1.4.2 will be included.
Also, self-evidently, the Alpine base (e.g., python: 3-alpine
) doesn't work with this.
DON'Ts
Dockerfile
RUN apt-get update && apt-get install -y build-essential libssl-dev libffi-dev python-dev
Because the image size becomes large. However, there is an advantage that the latest cffi (cffi 1.6.0 as of May 26, 2016) can be used.
Let's have a comfortable cryptographic programming life.
Recommended Posts