Add SSH debian

This commit is contained in:
2026-09-19 12:11:02 +00:00
parent 751ca8d4ca
commit e720828d8b

View File

@@ -51,4 +51,48 @@
name: lan
external: true
- name: RD-debian-shell-withSSH
descr: Minimal Debian 13 (trixie-slim) shell for one-off tasks
page: https://hub.docker.com/_/debian
category: development
default-credentialss: none
auto-update: false
services:
debian-shell:
image: docker.io/library/debian:trixie-slim
hostname: debian-shell
environment:
DEBIAN_FRONTEND: noninteractive
configs:
- source: 'ssh_authorized_keys'
target: '/etc/ssh_authorized_keys'
mode: 0644
- source: 'start_sshd'
target: '/start-sshd.sh'
mode: 0755
command: /start-sshd.sh # <-- this is it: run the script below as the container's PID 1
ports:
- 22:22:ssh
restart: unless-stopped
configs: # top-level configs: block — this is where the SCRIPT CONTENT actually lives
'ssh_authorized_keys':
content: |
ssh-ed25519 AAAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx name@yourhost
'start_sshd':
content: |
#!/bin/sh
set -e
if ! command -v sshd >/dev/null 2>&1; then
apt-get update
apt-get install -y --no-install-recommends openssh-server
rm -rf /var/lib/apt/lists/*
fi
mkdir -p /run/sshd /root/.ssh
cp /etc/ssh_authorized_keys /root/.ssh/authorized_keys
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
exec /usr/sbin/sshd -D -e
#The END