Netmiko Python package on Alpine

Problem:

For a current project I was looking to use netmiko to administrate a Cisco router - and given my natural affinity for Docker I'm planning to use a container to run the script, so I do not have to depend on an external server being set up with the correct dependencies. Of course that means getting the dependencies onto the container first!

Solution:

I'm using the standard python docker containers. I like alpine - I could have used debian but it's just so fat, over 700mb!

Alpine it is - but we need to install netmiko.

The required libraries are the following:

build-base libffi-dev openssl-dev

You can then use pip to install netmiko.

An example dockerfile (you may see this in a future post!):

FROM python:alpine
MAINTAINER David Chidell

RUN apk --no-cache add build-base libffi-dev openssl-dev openssl
RUN pip install --no-cache-dir netmiko

COPY import_cert.py .

ENTRYPOINT ["python", "./import_cert.py"]
CMD ["--help"]

VOLUME ["/certs"]