microsoft / VSTS-Docker-Preview

Preview repo for Docker extension
16 stars 8 forks source link

Could not load X509 key pair: open '.dockercerts/cert.pem': no such file or directory. Make sure the key is not encrypted #12

Closed djeeg closed 7 years ago

djeeg commented 7 years ago

Hi,

I am unable to run docker commands with the latest version of the plugin

Trying to run a very simple command "ps -a", I get this output:


******************************************************************************
Starting: Build
******************************************************************************
Current agent version: '2.109.2'
******************************************************************************
Starting: Get Sources
******************************************************************************
******************************************************************************
Starting: Run a Docker command
******************************************************************************
==============================================================================
Task         : Docker
Description  : Build, push or run Docker images, or run a Docker command
Version      : 0.3.1
Author       : Microsoft Corporation
Help         : [More Information](http://aka.ms/dockertoolsforvsts)
==============================================================================
8da9c0f3********** exists true
41660d8e********** exists true
/usr/bin/docker -H tcp://******:2376 --tls --tlscacert='.dockercerts/ca.pem' --tlscert='.dockercerts/cert.pem' --tlskey='.dockercerts/key.pem' login -u ******** -p ******** ********
Could not load X509 key pair: open '.dockercerts/cert.pem': no such file or directory. Make sure the key is not encrypted
/usr/bin/docker -H tcp://*******:2376 --tls --tlscacert='.dockercerts/ca.pem' --tlscert='.dockercerts/cert.pem' --tlskey='.dockercerts/key.pem' ps -a
Could not load X509 key pair: open '.dockercerts/cert.pem': no such file or directory. Make sure the key is not encrypted
Could not load X509 key pair: open '.dockercerts/cert.pem': no such file or directory. Make sure the key is not encrypted
djeeg commented 7 years ago

I have now found that Microsoft is providing a pre-configured VSTS agent docker image Which has both the agent and docker installed in the same container

https://hub.docker.com/r/microsoft/vsts-agent/

With VSTS connected to this agent, docker commands execute as expected. Issue by-passed.

My previous setup, where I was getting the error, was a custom built VSTS agent, which then executed docker on a different host Most of the instructions I got from here: https://www.visualstudio.com/en-us/docs/build/admin/agents/v2-linux http://donovanbrown.com/post/2016/06/03/Building-a-Linux-Based-Visual-Studio-Team-Service-Build-Machine-with-Docker-Support https://raw.githubusercontent.com/DarqueWarrior/linuxSetup/master/linuxSetup.sh