gns3-registry/docker/network_automation/Dockerfile
Pratik Raj 707f96e501 chore : use --no-cache-dir flag to pip in dockerfiles to save space
using --no-cache-dir flag in pip install ,make sure downloaded packages
by pip don't cached on system . This is a best practice which make sure
to fetch from repo instead of using local cached one . Further , in case
of Docker Containers , by restricting caching , we can reduce image size.
In term of stats , it depends upon the number of python packages
multiplied by their respective size . e.g for heavy packages with a lot
of dependencies it reduce a lot by don't caching pip packages.

Further , more detail information can be found at

https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6

Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
2021-09-22 15:26:14 +05:30

23 lines
1.2 KiB
Docker

# docker base image for Netmiko, NAPALM, Pyntc, and Ansible
FROM ubuntu:bionic
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y --no-install-recommends \
install telnet curl openssh-client nano vim-tiny iputils-ping build-essential \
libssl-dev libffi-dev python3-pip python3-dev python3-setuptools \
net-tools python3 software-properties-common \
&& apt-add-repository -y ppa:ansible/ansible-2.8 \
&& apt-get update && apt-get -y --no-install-recommends install ansible \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache-dir wheel \
&& pip3 install --no-cache-dir cryptography netmiko napalm pyntc \
&& pip3 install --no-cache-dir --upgrade paramiko && mkdir /scripts \
&& mkdir /root/.ssh/ \
&& echo "KexAlgorithms diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1" > /root/.ssh/config \
&& echo "Ciphers 3des-cbc,blowfish-cbc,aes128-cbc,aes128-ctr,aes256-ctr" >> /root/.ssh/config \
&& chown -R root /root/.ssh/
VOLUME [ "/root","/usr", "/scripts" ]
CMD [ "sh", "-c", "cd; exec bash -i" ]