-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.ubuntu
More file actions
68 lines (58 loc) · 2.13 KB
/
Copy pathDockerfile.ubuntu
File metadata and controls
68 lines (58 loc) · 2.13 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
###########################################
# Official Image Ubuntu with OpenSSH server
# Allow SSH connection to the container
# Installed: openssh-server, mc, htop, zip,
# tar, iotop, ncdu, nano, vim, bash, sudo
# for net: ping, traceroute, telnet, host,
# nslookup, iperf, nmap
###########################################
ARG IMAGE_VERSION="ubuntu:24.04"
FROM $IMAGE_VERSION
# Label docker image
ARG IMAGE_VERSION
MAINTAINER DevDotNet.Org <anton@devdotnet.org>
LABEL maintainer="DevDotNet.Org <anton@devdotnet.org>"
LABEL build_version="Image version:- ${IMAGE_VERSION}"
# Base
# Set the locale
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Password for ssh
ENV USER_PASSWORD=123456
# Copy to image
COPY copyables /
# Install
RUN apt-get update && apt-get -y upgrade \
&& apt-get install -y openssh-server \
# Utils
&& apt-get install -y mc htop iotop ncdu tar zip nano vim bash sudo sed \
# Net utils
&& apt-get install -y iputils-ping traceroute telnet dnsutils iperf nmap \
# Deleting keys
&& rm -rf /etc/ssh/ssh_host_dsa* /etc/ssh/ssh_host_ecdsa* /etc/ssh/ssh_host_ed25519* /etc/ssh/ssh_host_rsa* \
# Config SSH
&& sed -ri "s|^#PermitRootLogin|PermitRootLogin|" /etc/ssh/sshd_config \
&& sed -i "s|PermitRootLogin without-password|PermitRootLogin yes|" /etc/ssh/sshd_config \
&& sed -i "s|PermitRootLogin prohibit-password|PermitRootLogin yes|" /etc/ssh/sshd_config \
&& sed -ri "s|^#?PermitRootLogin\s+.*|PermitRootLogin yes|" /etc/ssh/sshd_config \
&& sed -ri "s|^#PasswordAuthentication|PasswordAuthentication|" /etc/ssh/sshd_config \
&& sed -ri "s|^PasswordAuthentication no|PasswordAuthentication yes|" /etc/ssh/sshd_config \
&& sed -ri "s|UsePAM yes|#UsePAM yes|g" /etc/ssh/sshd_config \
# Folder Data
&& mkdir -p /data \
# Cleaning
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/ \
&& rm -rf /var/lib/apt/lists/*.lz4 \
&& rm -rf /var/log/* \
&& rm -rf /tmp/* \
&& rm -rf /var/tmp/* \
&& rm -rf /usr/share/doc/ \
&& rm -rf /usr/share/man/ \
&& rm -rf $HOME/.cache \
&& chmod +x /entrypoint.sh
# Port SSH
EXPOSE 22/tcp
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/sbin/sshd", "-D"]