SSH на Гите с докером - PullRequest
       20

SSH на Гите с докером

0 голосов
/ 31 января 2019

Я только что установил gitea с помощью docker в Linux mint 19, я использовал / data со старой установкой gitea, поэтому у меня есть заполненные базы данных и репозитории.Кажется, что работает правильно, когда я получаю доступ к сети.

Проблема заключается в использовании SSH:

➜  /tmp sudo git clone git@gitealocal:felipe/test.git
Cloning into 'test'...
ssh: connect to host gitealocal port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


➜  /tmp ssh -vT gitealocal
OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /home/felipe/.ssh/config
debug1: /home/felipe/.ssh/config line 16: Applying options for gitealocal
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitealocal [127.0.1.1] port 10022.
debug1: Connection established.
debug1: identity file /home/felipe/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/felipe/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/felipe/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/felipe/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/felipe/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/felipe/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/felipe/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/felipe/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
ssh_exchange_identification: Connection closed by remote host

Я проверяю права доступа к каталогу и файлам /var/lib/gitea/ssh, но, похоже, это правильно.drwx------ и -rw-------

1 Ответ

0 голосов
/ 31 января 2019

Вам нужно предоставить порт ssh 22 при запуске контейнера Docker, попробуйте:

docker run --expose 22 ...

Или еще лучше добавить 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"]
...