在启用TLS的jenkins管道中从shell脚本运行docker-compose

时间:2019-01-17 16:19:38

标签: docker jenkins docker-compose

我们已经成功地像这样运行了一部分管道部署。

dir('pipeline') {
                    sh """
                    scp -r compose ${DEPLOY_ENV}:/tmp
                    ssh -t ${DEPLOY_ENV} 'export HOSTNAME=${DEPLOY_ENV}; cd /tmp/compose; docker-compose down; docker-compose up -d'
                    """
                }

今天,由于另一个原因,我们公开了docker的TCP端口,并启用了TLS。

现在,当我尝试部署时,我得到了

ssh -t machine export HOSTNAME=machine; cd /tmp/compose; docker-compose down; docker-compose up -d
Pseudo-terminal will not be allocated because stdin is not a terminal.
Couldn't connect to Docker daemon at https://127.0.0.1:2376 - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Couldn't connect to Docker daemon at https://127.0.0.1:2376 - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

我可以在机器上的命令行上运行docker-compose命令,并且在我将其更改为测试时,该脚本肯定是在机器上的/ etc / environment中拾取env变量。

我觉得我需要以某种方式提供证书和密钥,但是却在努力寻找方法?

有没有人看过这个书或者有什么想法?

0 个答案:

没有答案