From 064481d8b971e347c163321a3cd1bed96cca7586 Mon Sep 17 00:00:00 2001 From: daniel Date: Sat, 29 Jun 2024 23:14:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=9B=9E=E6=BB=9A?= =?UTF-8?q?=E8=A1=A8=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linux/sh/entrypoint.sh | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/linux/sh/entrypoint.sh b/linux/sh/entrypoint.sh index 7e2be50..922d00c 100755 --- a/linux/sh/entrypoint.sh +++ b/linux/sh/entrypoint.sh @@ -12,30 +12,22 @@ function check_vnc_pass { export X11_ARGS="" fi } +if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then + # Generate ssh key + ssh-keygen -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key + ssh-keygen -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key + ssh-keygen -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key +fi -# 切换回 root 用户来执行特权命令 -if [ "$(id -u)" -eq 0 ]; then - if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then - # Generate ssh key - ssh-keygen -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key - ssh-keygen -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key - ssh-keygen -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key - fi - - check_vnc_pass - - if [[ -n $USER_PASSWORD ]]; then - echo "docker:$USER_PASSWORD" | chpasswd - fi - if [[ -n $PUID ]]; then - usermod -u "$PUID" docker - fi - if [[ -n $PGID ]]; then - groupmod -g "$PGID" docker - fi +check_vnc_pass - # 切换到 docker 用户 - exec su docker -c "/etc/entrypoint.sh" +if [[ -n $USER_PASSWORD ]];then + echo "docker:$USER_PASSWORD" | chpasswd +fi +if [[ -n $PUID ]]; then + usermod -u "$PUID" docker +fi +if [[ -n $PGID ]]; then + groupmod -g "$PGID" docker fi - /usr/bin/supervisord