Docker运行人gitlab-runner 无法 scp到远程服务器的问题
[root@sannian data-ci]# docker search gitlab-runner [root@sannian data-ci]# docker pull gitlab/gitlab-runner [root@sannian data-ci]# docker run -d -v /data-ci/:/data-ci/ --restart=always --name gitlab-runner gitlab/gitlab-runner
然后注册:
[root@sannian data-ci]# docker exec -it 80ac801e633b gitlab-runner register Runtime platform arch=amd64 os=linux pid=16 revision=cf91d5e1 version=11.4.2 Running in system-mode. Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/): http://47.99.145.156:9999/ Please enter the gitlab-ci token for this runner: Ah-B41xF53-R4M6bamrE Please enter the gitlab-ci description for this runner: [80ac801e633b]: Please enter the gitlab-ci tags for this runner (comma separated): my-erp Registering runner... succeeded runner=Ah-B41xF Please enter the executor: docker, docker-ssh, parallels, virtualbox, docker-ssh+machine, shell, ssh, docker+machine, kubernetes: shell Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
这后就是gitlab报错
然后就是发现用户是--user=gitlab-runner
[root@sannian data-ci]# ps -ef | grep gitlab-runner root 31028 30984 0 10:30 ? 00:00:00 /usr/bin/dumb-init /entrypoint run --user=gitlab-runner --working-directory=/home/gitlab-runner root 31091 31028 0 10:30 ? 00:00:00 gitlab-runner run --user=gitlab-runner --working-directory=/home/gitlab-runner root 31155 31017 0 10:30 pts/2 00:00:00 grep --color=auto gitlab-runner
为了解决这个问题
进入容器
[root@sannian data-ci]# docker exec -it 80ac801e633b /bin/bash root@80ac801e633b:/# su gitlab-runner gitlab-runner@80ac801e633b:/$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/gitlab-runner/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/gitlab-runner/.ssh/id_rsa. Your public key has been saved in /home/gitlab-runner/.ssh/id_rsa.pub. The key fingerprint is: SHA256:SzbhlkF6U+eHCSqToSnHzrivfbLEl+zJLk0G3KUsI3M gitlab-runner@80ac801e633b The key's randomart image is: +---[RSA 2048]----+ | . . o . | | . o =.o + o | | ..=o=o* + . | | o*E += = . | | .+o+ S | | o .o= o | | . o++ . | | +o+o. | | ..+*= | +----[SHA256]-----+ gitlab-runner@80ac801e633b:/$ vim /home/gitlab-runner/.ssh/id_rsa.pub
把密复制到远程主机上。光这个还不行,还要在容器里测试一下
gitlab-runner@80ac801e633b:/$ scp -r /data-ci/eatjoys-front.sh root@47.99.89.247://data-ci/eatjoys-front.sh The authenticity of host '47.99.89.247 (47.99.89.247)' can't be established. ECDSA key fingerprint is SHA256:a6E2UXjP1qIZLmHAS6LAfyeUjsidFhTCZxefKC4cDGk. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '47.99.89.247' (ECDSA) to the list of known hosts. eatjoys-front.sh
第一次,一定要输入一下yes 才会通过, 然后看gitlab上
通过了,这样就可以继续下一步 写脚本咯~!
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
如何在Kubernetes里给PostgreSQL创建secret
创建一个initdb.sql文件,输入如下内容: -- This is a postgres initialization script for the postgres container. -- Will be executed during container initialization ($> psql postgres -f initdb.sql) CREATE ROLE adsuser WITH LOGIN PASSWORD 'initial' INHERIT CREATEDB; CREATE DATABASE ads WITH ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0; GRANT ALL PRIVILEGES ON DATABA
- 下一篇
Docker Windows Server 应用迁移计划上线,让您轻松处理旧版应用程序!
出品丨Docker公司(ID:docker-cn)编译丨小东每周一、三、五,与您不见不散! 上周,我们发布了 Docker Windows Server 应用程序迁移计划,旨在帮助公司快速、轻松地迁移应用程序以及对旧版的 Windows Server 2008 应用程序进行现代化改造,同时推动在任何地方的任何应用程序进行持续创新。 我们认识到 Windows Server 2008 是当今使用最广泛的操作系统之一,而即将在 2020年1月到来的停止支持让 IT 组织几乎没有可行的选择来经济、高效地保护其旧版的应用程序和数据。 Docker Windows Server 应用程序迁移计划是实现容器化和保护旧版 Windows Server 应用程序的最佳和唯一方法,同时可以让软件驱动业务实现转型。通过 Docker Windows Server 应用程序迁移计划,客户得到: Docker Enterprise:业界领先的、唯一适用于 Windows Server 应用程序的企业级容器平台。 Docker Enterprise 是业界领先的企业级容器平台,为数百万开发人员和 IT 专业人士...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- CentOS7编译安装Gcc9.2.0,解决mysql等软件编译问题
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- Docker使用Oracle官方镜像安装(12C,18C,19C)
- 设置Eclipse缩进为4个空格,增强代码规范
- Windows10,CentOS7,CentOS8安装MongoDB4.0.16
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- CentOS8安装Docker,最新的服务器搭配容器使用
- SpringBoot2更换Tomcat为Jetty,小型站点的福音
- CentOS7安装Docker,走上虚拟化容器引擎之路