# Create swarm host without internet access

**URL:** <https://forums.docker.com/t/create-swarm-host-without-internet-access/16092>\
**Category:** Machine\
**Created:** [June 21, 2016, 8:39am UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092 "2016-06-21T08:39:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![sronsiek](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sronsiek](https://forums.docker.com/u/sronsiek)\
**Post date:** [June 21, 2016, 8:39am UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/1 "2016-06-21T08:39:21Z")

</div>

Hi,

We are trying to set up a swarm of hosts in a private, operational network which must be controlled in terms of version numbers of images, tools etc. No internet access is permitted from these hosts. Images can be installed onto hosts via docker save / load.

docker-engine is pre-installed, but `docker-machine create` attempts to access [index.docker.io](http://index.docker.io), resulting in `Error creating machine`:

```auto
docker-machine create -d generic \
   --generic-ip-address 192.168.100.1 \
   --generic-ssh-user <ssh-user> \
   --generic-ssh-key ~/.ssh/swarm \
   --engine-install-url "" \
   --swarm \
   --swarm-master \
   --swarm-discovery token://<swarm token> \
   swarm1

```

```auto
Error creating machine: Error running provisioning: Unable to pull image: Error while pulling image: Get https://index.docker.io/v1/repositories/library/swarm/images: dial tcp: lookup index.docker.io: no such host
s

```

Note that a swarm image is pre-installed on the host:

```auto
root@swarm1# docker images | grep swarm
swarm latest 7dbfc39dd91a 3 weeks ago 19.34 MB

```

How can we configure machine to not access the web? Setting `--engine-install-url` to an empty string does not work.

Any help appreciated,

cheers

---

<div class="post-metadata">

**Author:** ![dvohra](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/dvohra/32/5429_2.png) [@dvohra](https://forums.docker.com/u/dvohra)\
**Post date:** [June 21, 2016, 8:17pm UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/2 "2016-06-21T20:17:10Z")

</div>

> [@sronsiek](#):
>
> swarm1

Why is image name set to swarm1?

---

<div class="post-metadata">

**Author:** ![sronsiek](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sronsiek](https://forums.docker.com/u/sronsiek)\
**Post date:** [June 22, 2016, 7:16am UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/3 "2016-06-22T07:16:25Z")

</div>

@dvohra: The described hosts are physical PCs running Linux. My understanding was that `docker-machine create` provisions hosts (incl setting the hostname), and that a discovery container plus swarm-containers with manager and / or node roles are subsequently launched on such hosts using docker swarm. The intention is that several hosts/machines (swarm1, swarm2, swarm3) act as both manager and node, thus avoiding a single point of failure / providing high availability.

So to me `swarm1` is the hostname of the physical machine & I don’t really understand why you refer to `swarm1` as an ‘image’. Please correct if I’m wrong!

---

<div class="post-metadata">

**Author:** ![dvohra](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/dvohra/32/5429_2.png) [@dvohra](https://forums.docker.com/u/dvohra)\
**Post date:** [June 22, 2016, 1:25pm UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/4 "2016-06-22T13:25:57Z")

</div>

What machines does the **docker-machine ls** command list?

> **[docker-machine ls](https://docs.docker.com/machine/reference/ls/)**
>
> Usage: docker-machine ls \[OPTIONS\] \[arg...\] List machines Options: --quiet, -q Enable quiet mode --filter \[--filter option --filter option\] Filter output based on conditions provided --timeout, -t

---

<div class="post-metadata">

**Author:** ![sronsiek](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sronsiek](https://forums.docker.com/u/sronsiek)\
**Post date:** [June 23, 2016, 7:50pm UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/5 "2016-06-23T19:50:24Z")

</div>

As expected:

```auto
docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
swarm1 * generic Running tcp://192.168.100.1:2376 swarm1 (master) v1.9.1

```

---

<div class="post-metadata">

**Author:** ![dvohra](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/dvohra/32/5429_2.png) [@dvohra](https://forums.docker.com/u/dvohra)\
**Post date:** [June 25, 2016, 12:04am UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/6 "2016-06-25T00:04:00Z")

</div>

Auhentication may be required as in the url  
[https://index.docker.io/v1/repositories/library/swarm/](https://index.docker.io/v1/repositories/library/swarm/)

---

<div class="post-metadata">

**Author:** ![sronsiek](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sronsiek](https://forums.docker.com/u/sronsiek)\
**Post date:** [June 27, 2016, 7:29am UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/7 "2016-06-27T07:29:17Z")

</div>

This may be the cause of the error, however the question was how to prevent the attempts to access the internet. The require swarm image is already installed on the host:

```auto
$ docker images | grep swarm
docker.xx.xxx.loc/swarm latest 90ede5966b52 2 weeks ago 19.34 MB

```

---

<div class="post-metadata">

**Author:** ![sronsiek](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sronsiek](https://forums.docker.com/u/sronsiek)\
**Post date:** [June 28, 2016, 2:59pm UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/8 "2016-06-28T14:59:45Z")

</div>

Ok, so the answer is: For a private cluster (no nodes in the cloud) there is no need to create a swarm token, and no need to create anything using docker-machine. In fact docker-machine is not needed at all. We deploy required images (‘swarm’, ‘consul’ & our own apps) via docker save / docker load. The is it possible simply to start consul, manage & node on the hosts.

---

<div class="post-metadata">

**Author:** ![dvohra](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/dvohra/32/5429_2.png) [@dvohra](https://forums.docker.com/u/dvohra)\
**Post date:** [June 28, 2016, 3:06pm UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/9 "2016-06-28T15:06:16Z")

</div>

Docker Machine is typically used for remote nodes.

---

<div class="post-metadata">

**Author:** ![princeharry](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@princeharry](https://forums.docker.com/u/princeharry)\
**Post date:** [July 17, 2016, 5:00pm UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/10 "2016-07-17T17:00:27Z")

</div>

Docker swarm needs a discovery backend and the discovery-token is used when you use the swarm discovery backend provided by [hub.docker.com](http://hub.docker.com). You can run your own consul discovery backend, just pass consul://ip:port instead of token://token

You’ll always need internet access when using the hosted discovery backend!

---

<div class="post-metadata">

**Author:** ![sronsiek](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sronsiek](https://forums.docker.com/u/sronsiek)\
**Post date:** [August 5, 2016, 9:58am UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/11 "2016-08-05T09:58:50Z")

</div>

And that’s the answer I was looking for - I had not realized the token is **not** required when running my own discovery service! Thanks!

---

<div class="post-metadata">

**Author:** ![suryakiran143](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/suryakiran143/32/32457_2.png) [@suryakiran143](https://forums.docker.com/u/suryakiran143)\
**Post date:** [February 17, 2022, 9:48am UTC](https://forums.docker.com/t/create-swarm-host-without-internet-access/16092/12 "2022-02-17T09:48:38Z")

</div>

Hi Guys, i’m a master’s student working on my thesis. i’m trying to setup a docker swarm without internet, i have two pc on localLAN. one as leader and another as worker. i created swarm exposing the privateIP of leader

```auto
 --advertise-addr 192.168.1.202 

```

i executed worker token on worker node and i can see worker node is in swarm but service is failing .!! any help please
