Kenenbek Arzymatov
Kenenbek Arzymatov

Reputation: 9119

Docker secure connection with ssh port forwarding

I made a ssh tunnel for port forwarding to get mapped a port on my laptop with port on the remote host (your-mv.com):

ssh -nfNT -L 3376:your-mv.com:3376 [email protected] 

Then I changed docker_host and setup docker tls variables:

export DOCKER_HOST=localhost:3376
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=/my/path

And I run:

docker ps

But I have an error:

Get https://localhost:3376/v1.26/containers/json: x509: certificate is valid for your-mv.com, not localhost

Could you help me what did I wrong and how to overcome this problem?

UPD

Common name of my laptop is subject= /CN=kenenbek. Common name of CA is subject= /CN=cert-authority.com and common name of remote host is subject= /CN=your-vm.com.

Upvotes: 1

Views: 603

Answers (1)

Ricardo Branco
Ricardo Branco

Reputation: 6079

DOCKER_TLS_VERIFY is set and the certificate has the Common Name of your-mv.com, but DOCKER_HOST was set to localhost.

Do not set DOCKER_TLS_VERIFY.

Upvotes: 1

Related Questions