As a result, we Mac users typically find ourselves running a Linux. The rule is named docker, the protocol is set to tcp and port 2375 on the. The 2375 port is the Rest-API port of docker daemon, if we are using the Windows-os, it’s easy to resolve. Go to settings menu of the Docker for windows, and check to the Expose daemon on.
![]() ![]() ![]()
Run commands on remote Docker hostThis is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation. Enable Docker Remote APIFirst be sure to enable the Docker Remote API on the remote host.This can easily be done with a container.For HTTP connection use.For HTTPS connection use.You can also configure the Docker engine to expose the remote API. Read for more information.
# Linux/Mac export DOCKERTLSVERIFY= '1 ' export DOCKERHOST= 'tcp://your-remote-server.org:2376 ' export DOCKERCERTPATH= '/home/me/docker-tls ' # Windows Powershell $env:DOCKERTLSVERIFY= '1 ' $env:DOCKERHOST= 'tcp://your-remote-server.org:2376 ' $env:DOCKERCERTPATH= 'C:usersmedocker-tls 'Be sure that your DOCKERCERTPATH directory contains the following files:. ca.pem (CA certificate). cert.pem (client certificate). key.pem (client's private key)Now any docker command will run against the remote api. # Linux/Mac unset DOCKERHOSTunset DOCKERTLSVERIFYunset DOCKERCERTPATH# Windows PowershellRemove-Item env:DOCKERHOSTRemove-Item env:DOCKERTLSVERIFYRemove-Item env:DOCKERCERTPATH Reuse SSH connection (Linux, Mac, Windows(?))If you already added an SSH public key to your remote server, then you can use this ssh credentials for your docker connection, too.
You don't need to configure the remote api on the server for this approach.(Should work on Windows, but I did only test on Linux yet)Set the env var to a ssh address. This is what happens when i run docker.bat ps: U:docker.bat psU:docker -H=TEMP-HYPERV:2375 psU:docker -H=TEMP-HYPERV:2375 -H=TEMP-HYPERV:2375 psU:docker -H=TEMP-HYPERV:2375 -H=TEMP-HYPERV:2375 -H=TEMP-HYPERV:2375 psU:docker -H=TEMP-HYPERV:2375 -H=TEMP-HYPERV:2375 -H=TEMP-HYPERV:2375 -H=TEMP-HYPERV:2375 psand it goes on to infinity until i cancel.Basically, it happens if you name the script docker.bat specifically, AND run it in the folder where it exists. Name it something else, or run it from another directory.
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |