Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git-ssh可以';无法在docker容器中访问gitlab_Git_Ssh_Gitlab_Ssh Keys_Docker - Fatal编程技术网

git-ssh可以';无法在docker容器中访问gitlab

git-ssh可以';无法在docker容器中访问gitlab,git,ssh,gitlab,ssh-keys,docker,Git,Ssh,Gitlab,Ssh Keys,Docker,我将gitlab安装在带有docker的容器中,docker已经公开了22个。当我ssh-vvgit@host.com我无法使用ssh公钥访问,只有密码方法有效 如何获得对docker容器的ssh访问权限 谢谢。这取决于: 如何在docker容器中安装openssh服务(请参见“”) 见(2014年1月) 如果您确实有一个~git/.ssh/authorized_keys文件,其中包含正确的公钥 最后,我解决了我的问题 sudo docker run-p 2222:22-d somethin

我将gitlab安装在带有docker的容器中,docker已经公开了22个。当我
ssh-vvgit@host.com
我无法使用ssh公钥访问,只有密码方法有效

如何获得对docker容器的ssh访问权限

谢谢。

这取决于:

  • 如何在docker容器中安装openssh服务(请参见“”)
    见(2014年1月)

  • 如果您确实有一个
    ~git/.ssh/authorized_keys
    文件,其中包含正确的公钥


    • 最后,我解决了我的问题


      sudo docker run-p 2222:22-d something
      ,这会将容器的端口
      22
      重定向到主机的
      2222
      ,然后我可以使用
      ssh HOST.com-p 2222
      登录到容器+1.我的答案更多的是在安装方面。如果你想推到
      git@server
      不使用
      :2222
      # Install apache and ssh server
      RUN sudo apt-get install -y openssh-server apache2 postgresql-9.3
      RUN mkdir -p /var/run/sshd