entrypoint.sh

#!/bin/bash

/usr/bin/rsync --daemon --config=/etc/rsync.conf
/usr/sbin/sshd -D

rsync.conf

# 编辑配置信息
max connections = 8
log file = /var/log/rsync.log
timeout = 300

[sync] # 模块名
comment = sync
# path为需要同步的文件夹路径
path = /root/sync
read only = no
list = yes
uid = root
gid = root

Dockerfile

FROM ubuntu:latest

RUN apt-get update

RUN apt-get install -y build-essential
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y cmake
RUN apt-get install -y gdb
RUN apt-get install -y net-tools

RUN apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config

RUN apt-get install -y rsync
RUN sed -ri 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/g' /etc/default/rsync
COPY rsync.conf /etc

RUN echo 'root:000000' |chpasswd

RUN mkdir /root/sync

COPY entrypoint.sh /sbin
RUN chmod +x /sbin/entrypoint.sh
ENTRYPOINT [ "/sbin/entrypoint.sh" ]

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code