# Connect to remote docker host

**URL:** <https://forums.docker.com/t/connect-to-remote-docker-host/13112>\
**Category:** General\
**Tags:** docker\
**Created:** [May 22, 2016, 5:46pm UTC](https://forums.docker.com/t/connect-to-remote-docker-host/13112 "2016-05-22T17:46:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![codematix](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/codematix/32/10384_2.png) [@codematix](https://forums.docker.com/u/codematix)\
**Post date:** [May 22, 2016, 5:46pm UTC](https://forums.docker.com/t/connect-to-remote-docker-host/13112/1 "2016-05-22T17:46:43Z")

</div>

How can I connect my local docker client to a remote docker host on my network?

I have a ubuntu server box on my local network on which I intend to setup my containers. However, at this point, I have to SSH into that box from my development box manually and then run the containers.

I attempted to set the `$DOCKER_HOST` environment variable on my development box and also ensured that the 2376 port is opened on the docker host box. But when I tried to run the docker commands, but I keep getting the message:

`Cannot connect to the Docker daemon. Is the docker daemon running on this host?`

P.S. Is there a way to configure my docker host to bind the docker server to a different hostname and port?

---

<div class="post-metadata">

**Author:** ![nathanleclaire](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@nathanleclaire](https://forums.docker.com/u/nathanleclaire)\
**Post date:** [May 24, 2016, 1:12am UTC](https://forums.docker.com/t/connect-to-remote-docker-host/13112/2 "2016-05-24T01:12:54Z")

</div>

Ensure that the `-H` flag for `docker daemon` running on the remote instance is set to whatever you desire (e.g. `0.0.0.0:2376`). You will likely have to edit `/etc/systemd/system/docker.service` and restart the daemon for this. The daemon only listens on a UNIX socket at `/var/run/docker.sock` by default.

If you expose the API on the public internet (or even in a shared local Intranet) please use TLS. Otherwise _anyone_ with access to the Docker API will have effective root prvileges on that server.

---

<div class="post-metadata">

**Author:** ![vijaychandran](https://avatars.discourse-cdn.com/v4/letter/v/59ef9b/32.png) [@vijaychandran](https://forums.docker.com/u/vijaychandran)\
**Post date:** [October 12, 2017, 4:29am UTC](https://forums.docker.com/t/connect-to-remote-docker-host/13112/3 "2017-10-12T04:29:02Z")

</div>

i am using jenkins server on cloud machine and configured yet another plugin  
i want to add docker as slave in jenkins .How to use this ?

previously ,configured jenkins and docker in same machine and its working fine .

---

<div class="post-metadata">

**Author:** ![razfaz23](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@razfaz23](https://forums.docker.com/u/razfaz23)\
**Post date:** [June 1, 2018, 11:40am UTC](https://forums.docker.com/t/connect-to-remote-docker-host/13112/4 "2018-06-01T11:40:44Z")

</div>

Hi, does this require the option --tlsverify or is --tls sufficient? Will my docker daemon accept connections using any certificate when using --tls instead of --tlsverify?

---

<div class="post-metadata">

**Author:** ![s93rastogi](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@s93rastogi](https://forums.docker.com/u/s93rastogi)\
**Post date:** [December 17, 2019, 3:54pm UTC](https://forums.docker.com/t/connect-to-remote-docker-host/13112/5 "2019-12-17T15:54:23Z")

</div>

In order to connect to a remote Daemon running on any server machine please follow the below steps.  
Identify the Host machine where the Docker Client is running.  
If the Docker **Client Machine is a Linux Machine**. Please run the below command that connects to the remote docker Daemon.

```auto
export DOCKER_HOST=ssh://administrator@10.242.41.222

```

The above command will establish the ssh connection to the remote machine and all the docker command get executed on the remote machine.

If the **Docker Client Machine is a Windows Machine**. Please run the below command to obtain the same result as above.

```auto
$env:DOCKER_HOST="ssh://administrator@10.242.41.222"

```

If one wants the **docker client to use the old Docker daemon** running on the client server. Please reset the value of the environment variable to empty.

**In WIN :** $env:DOCKER\_HOST=" "  
**In Linux :** export DOCKER\_HOST=’ ’
