-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.centos7
More file actions
26 lines (20 loc) · 903 Bytes
/
Dockerfile.centos7
File metadata and controls
26 lines (20 loc) · 903 Bytes
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
FROM centos:7
# Point to vault repos since CentOS 7 is EOL
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
RUN yum install -y openssh-server sudo \
curl wget vim-minimal git nano \
htop tree zip unzip && \
yum clean all
# Configure SSH
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
# Create test user with sudo
RUN useradd -m -s /bin/bash testuser && \
echo 'testpass' | passwd --stdin testuser && \
echo 'testuser ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/testuser && \
chmod 440 /etc/sudoers.d/testuser
# Generate host keys
RUN ssh-keygen -A
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]