-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
113 lines (102 loc) · 3.44 KB
/
Dockerfile
File metadata and controls
113 lines (102 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
FROM debian:13-slim
LABEL maintainer="Federico A. Corazza <git@facorazza.com>"
LABEL description="Network troubleshooting toolkit for Kubernetes and Docker environments"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
aria2 \
bmon \
bridge-utils \
ca-certificates \
curl \
dnsutils \
ethtool \
gnupg \
# Required by AWS CLI
groff \
htop \
httpie \
iftop \
iotop \
ipcalc-ng \
iperf3 \
iproute2 \
iputils-arping \
iputils-ping \
iputils-tracepath \
jq \
ldap-utils \
less \
location \
lsof \
mosquitto-clients \
mtr-tiny \
mariadb-client-compat \
nano \
net-tools \
netcat-openbsd \
netstress \
ngrep \
nmap \
nfs-common \
openssh-client \
postgresql-client \
screen \
socat \
sysstat \
tcpdump \
tcptraceroute \
telnet \
tmux \
traceroute \
tree \
tshark \
unzip \
vim \
wget \
whois \
wrk \
yq \
zip \
&& \
rm -rf /var/lib/apt/lists/*
# Install etcd
RUN ARCH="$(dpkg --print-architecture)" && \
ETCD_VER=v3.6.7 && \
DOWNLOAD_URL=https://storage.googleapis.com/etcd && \
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-${ARCH}.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-${ARCH}.tar.gz && \
mkdir -p /tmp/etcd && \
tar xzvf /tmp/etcd-${ETCD_VER}-linux-${ARCH}.tar.gz -C /tmp/etcd --strip-components=1 --no-same-owner && \
rm -f /tmp/etcd-${ETCD_VER}-linux-${ARCH}.tar.gz && \
mv /tmp/etcd/etcd /usr/local/bin && \
mv /tmp/etcd/etcdctl /usr/local/bin && \
mv /tmp/etcd/etcdutl /usr/local/bin
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update && \
rm -r awscliv2.zip aws
# Install Kubectl
RUN ARCH="$(dpkg --print-architecture)" && \
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt) && \
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" && \
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl.sha256" && \
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check && \
rm kubectl.sha256 && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/kubectl
RUN kubectl version --client
# Install MongoDB shell
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
RUN echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/8.0 main" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list
RUN apt-get update && \
apt-get install -y \
mongodb-mongosh && \
rm -rf /var/lib/apt/lists/*
RUN mongosh --version
RUN useradd -m -s /bin/bash netkit && \
echo "netkit ALL=(ALL) NOPASSWD: /usr/bin/arping, /usr/bin/bmon, /usr/sbin/ethtool, /usr/bin/iftop, /usr/bin/iotop, /bin/ip, /usr/bin/nmap, /bin/nsenter, /usr/bin/socat, /usr/sbin/ss, /usr/bin/tcpdump, /usr/bin/tshark" >> /etc/sudoers
WORKDIR /home/netkit
USER netkit
CMD ["/bin/bash"]