我刚刚在 Linux mint 19 上使用 docker 安装了 gitea,我在旧的 gitea 安装中使用了 /data,所以我有一个填充数据库和存储库。当我访问网络时,它似乎工作正常。
\n\n问题是使用 SSH:
\n\n\xe2\x9e\x9c /tmp sudo git clone git@gitealocal:felipe/test.git\nCloning into 'test'...\nssh: connect to host gitealocal port 22: Connection refused\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\n\n\xe2\x9e\x9c /tmp ssh -vT gitealocal\nOpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017\ndebug1: Reading configuration data /home/felipe/.ssh/config\ndebug1: /home/felipe/.ssh/config line 16: Applying options for gitealocal\ndebug1: Reading configuration data /etc/ssh/ssh_config\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\ndebug1: Connecting to gitealocal [127.0.1.1] port 10022.\ndebug1: Connection established.\ndebug1: identity file /home/felipe/.ssh/id_rsa type 0\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /home/felipe/.ssh/id_rsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /home/felipe/.ssh/id_dsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /home/felipe/.ssh/id_dsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /home/felipe/.ssh/id_ecdsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /home/felipe/.ssh/id_ecdsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /home/felipe/.ssh/id_ed25519 type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /home/felipe/.ssh/id_ed25519-cert type -1\ndebug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1\nssh_exchange_identification: Connection closed by remote host\nRun Code Online (Sandbox Code Playgroud)\n\n我检查了目录和文件的权限/var/lib/gitea/ssh,但看起来是正确的。drwx------和-rw-------
22启动docker容器时需要暴露ssh端口,尝试:
docker run --expose 22 ...
Run Code Online (Sandbox Code Playgroud)
或者更好地EXPOSE 22按照官方文档添加到 Dockerfile 和 SSH 登录修复:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:screencast' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4472 次 |
| 最近记录: |