forked from Praqma/Network-MultiTool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
82 lines (55 loc) · 2.75 KB
/
Dockerfile
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
FROM alpine:3.18
MAINTAINER Sofus Albertsen
EXPOSE 80 443 1180 11443
# Install some tools in the container and generate self-signed SSL certificates.
# Packages are listed in alphabetical order, for ease of readability and ease of maintenance.
RUN apk update \
&& apk add apache2-utils bash bind-tools busybox-extras curl ethtool git \
iperf3 iproute2 iputils jq lftp mtr mysql-client \
netcat-openbsd net-tools nginx nmap nmap-scripts openssh-client openssl \
perl-net-telnet postgresql-client procps rsync socat tcpdump tshark wget \
&& mkdir /certs \
&& chmod 700 /certs \
&& openssl req \
-x509 -newkey rsa:2048 -nodes -days 3650 \
-keyout /certs/server.key -out /certs/server.crt -subj '/CN=localhost'
# Copy a simple index.html to eliminate text (index.html) noise which comes with default nginx image.
# (I created an issue for this purpose here: https://github.com/nginxinc/docker-nginx/issues/234)
COPY index.html /usr/share/nginx/html/
# Copy a custom/simple nginx.conf which contains directives
# to redirected access_log and error_log to stdout and stderr.
# Note: Don't use '/etc/nginx/conf.d/' directory for nginx virtual hosts anymore.
# This 'include' will be moved to the root context in Alpine 3.14.
COPY nginx.conf /etc/nginx/nginx.conf
COPY entrypoint.sh /docker/entrypoint.sh
# Start nginx in foreground:
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
# Note: If you have not included the "bash" package, then it is "mandatory" to add "/bin/sh"
# in the ENTNRYPOINT instruction.
# Otherwise you will get strange errors when you try to run the container.
# Such as:
# standard_init_linux.go:219: exec user process caused: no such file or directory
# Run the startup script as ENTRYPOINT, which does few things and then starts nginx.
ENTRYPOINT ["/bin/sh", "/docker/entrypoint.sh"]
###################################################################################################
# Build and Push (to dockerhub) instructions:
# -------------------------------------------
# docker build -t local/network-multitool .
# docker tag local/network-multitool praqma/network-multitool
# docker login
# docker push praqma/network-multitool
# Pull (from dockerhub):
# ----------------------
# docker pull praqma/network-multitool
# Usage - on Docker:
# ------------------
# docker run --rm -it praqma/network-multitool /bin/bash
# OR
# docker run -d praqma/network-multitool
# OR
# docker run -p 80:80 -p 443:443 -d praqma/network-multitool
# OR
# docker run -e HTTP_PORT=1180 -e HTTPS_PORT=11443 -p 1180:1180 -p 11443:11443 -d praqma/network-multitool
# Usage - on Kubernetes:
# ---------------------
# kubectl run multitool --image=praqma/network-multitool