Skip to content

Commit b024b19

Browse files
committed
add supervisor to start ssh
1 parent 4f5b03a commit b024b19

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

spark-cluster/base/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ ENV PATH=${CONDA_HOME}/bin:${SPARK_HOME}/bin:${HADOOP_HOME}/bin:${PATH}
2222
# setup ubuntu
2323
RUN apt-get update -y \
2424
&& apt-get upgrade -y \
25-
&& apt-get -y install openjdk-17-jdk wget ssh openssh-server sshpass supervisor \
25+
&& apt-get -y install openjdk-17-jdk wget sudo openssh-client openssh-server sshpass supervisor \
2626
&& apt-get -y install nano net-tools lynx \
2727
&& apt-get clean
2828

29+
RUN mkdir /var/run/sshd && \
30+
echo 'root:root' | chpasswd && \
31+
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
32+
2933
# setup ssh
3034
COPY ubuntu/root/.ssh/* /root/.ssh/
3135

@@ -60,3 +64,9 @@ RUN wget -q https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.s
6064
# clean up
6165
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
6266
&& mkdir /tmp/spark-events
67+
68+
COPY ubuntu/etc/supervisor/supervisor.conf /etc/supervisor/supervisor.conf
69+
COPY ubuntu/etc/supervisor/conf.d/ssh.conf /etc/supervisor/conf.d/ssh.conf
70+
71+
EXPOSE 22
72+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[program:sshd]
2+
command=/usr/sbin/sshd -D
3+
autostart=true
4+
autorestart=true
5+
stderr_logfile=/var/log/sshd.err.log
6+
stdout_logfile=/var/log/sshd.out.log
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
; supervisor config file
2+
3+
[unix_http_server]
4+
file=/var/run/supervisor.sock ; (the path to the socket file)
5+
chmod=0700 ; sockef file mode (default 0700)
6+
7+
[supervisord]
8+
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
9+
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
10+
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
11+
loglevel=debug
12+
nodaemon=true
13+
user=root
14+
15+
; the below section must remain in the config file for RPC
16+
; (supervisorctl/web interface) to work, additional interfaces may be
17+
; added by defining them in separate rpcinterface: sections
18+
[rpcinterface:supervisor]
19+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
20+
21+
[supervisorctl]
22+
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
23+
24+
; The [include] section can just contain the "files" setting. This
25+
; setting can list multiple files (separated by whitespace or
26+
; newlines). It can also contain wildcards. The filenames are
27+
; interpreted as relative to this file. Included files *cannot*
28+
; include files themselves.
29+
30+
[include]
31+
files = /etc/supervisor/conf.d/*.conf

0 commit comments

Comments
 (0)