# Unable to start inbound agent on windows server

**URL:** <https://community.jenkins.io/t/unable-to-start-inbound-agent-on-windows-server/2251>\
**Category:** Ask a question\
**Created:** [April 26, 2022, 6:25pm UTC](https://community.jenkins.io/t/unable-to-start-inbound-agent-on-windows-server/2251 "2022-04-26T18:25:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohitdalvi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/rohitdalvi/32/1396_2.png) [@rohitdalvi](https://community.jenkins.io/u/rohitdalvi)\
**Post date:** [April 26, 2022, 6:25pm UTC](https://community.jenkins.io/t/unable-to-start-inbound-agent-on-windows-server/2251/1 "2022-04-26T18:25:01Z")

</div>

I am using a docker image from [Docker Hub](https://hub.docker.com/r/jenkins/inbound-agent) to launch inbound agent on my windows ec2 instance.I am able to connect using the agent.jar method so no connection issues there, but when I try to run the inbound agent docker container I am unable to pass the Websocket parameter or as environment variable (JENKINS\_WEB\_SOCKET).

This is how I am launching the container,

```auto
docker run jenkins/inbound-agent:windowsservercore-1809 -Url https://myjenkins.com -Secret d ****** c -Name aws-jenkins-windows-inbound-agent -WebSocket true

```

But the container does not recognize it and failing with this error.

```nohighlight
true : The term 'true' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1

```

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [April 26, 2022, 7:48pm UTC](https://community.jenkins.io/t/unable-to-start-inbound-agent-on-windows-server/2251/2 "2022-04-26T19:48:30Z")

</div>

> [@rohitdalvi](#):
>
> but when I try to run the inbound agent docker container I am unable to pass the Websocket parameter or as environment variable (JENKINS\_WEB\_SOCKET).

how are you passing it?  
I don’t have a windows machine to test with, but i’m guessing -WebSocket is a boolean flag (true if there, false if not), so you don’t need to provide true, thus its trying to run “true” which isn’t a command in windows

---

<div class="post-metadata">

**Author:** ![rohitdalvi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/rohitdalvi/32/1396_2.png) [@rohitdalvi](https://community.jenkins.io/u/rohitdalvi)\
**Post date:** [April 26, 2022, 7:55pm UTC](https://community.jenkins.io/t/unable-to-start-inbound-agent-on-windows-server/2251/3 "2022-04-26T19:55:08Z")

</div>

> [@rohitdalvi](#):
>
> ```auto
> docker run jenkins/inbound-agent:windowsservercore-1809 -Url https://myjenkins.com -Secret d ****** c -Name aws-jenkins-windows-inbound-agent -WebSocket true
> 
> ```

I did pass without the true just -WebSocket, but it does not like that either, for instance,

```auto
docker run jenkins/inbound-agent:windowsservercore-1809 -Url https://myjenkins.com -Secret d ********** c -Name aws-jenkins-windows-inbound-2 -WorkDir 'C:\Jenkins2' -WebSocket
Apr 26, 2022 7:52:35 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: aws-jenkins-windows-inbound
Apr 26, 2022 7:52:35 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Apr 26, 2022 7:52:35 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.3
Apr 26, 2022 7:52:35 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using C:\Jenkins2\remoting as a remoting work directory
Apr 26, 2022 7:52:35 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to C:\Jenkins2\remoting
Apr 26, 2022 7:52:35 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Connection failed.
io.jenkins.remoting.shaded.javax.websocket.DeploymentException: Connection failed.
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.JdkClientContainer$1.call(JdkClientContainer.java:200)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.JdkClientContainer$1.call(JdkClientContainer.java:126)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.JdkClientContainer.openClientSocket(JdkClientContainer.java:205)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:663)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:712)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:866)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:511)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:355)
        at hudson.remoting.Engine.runWebSocket(Engine.java:627)
        at hudson.remoting.Engine.run(Engine.java:469)
Caused by: java.nio.channels.UnresolvedAddressException
        at sun.nio.ch.Net.checkAddress(Net.java:104)
        at sun.nio.ch.WindowsAsynchronousSocketChannelImpl.implConnect(WindowsAsynchronousSocketChannelImpl.java:332)
        at sun.nio.ch.AsynchronousSocketChannelImpl.connect(AsynchronousSocketChannelImpl.java:210)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.TransportFilter.handleConnect(TransportFilter.java:192)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.Filter.connect(Filter.java:103)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.Filter.connect(Filter.java:106)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.Filter.connect(Filter.java:106)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.ClientFilter.connect(ClientFilter.java:122)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.JdkClientContainer.connectSynchronously(JdkClientContainer.java:337)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.JdkClientContainer.access$700(JdkClientContainer.java:80)
        at io.jenkins.remoting.shaded.org.glassfish.tyrus.container.jdk.client.JdkClientContainer$1.call(JdkClientContainer.java:169)
        ... 12 more

```

---

<div class="post-metadata">

**Author:** ![saper](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/saper/32/138_2.png) [@saper](https://community.jenkins.io/u/saper)\
**Post date:** [April 27, 2022, 10:04pm UTC](https://community.jenkins.io/t/unable-to-start-inbound-agent-on-windows-server/2251/4 "2022-04-27T22:04:07Z")

</div>

> [@rohitdalvi](#):
>
> ```none
> Caused by: java.nio.channels.UnresolvedAddressException
> 
> ```

This means that your agent in the container cannot resolve `myjenkins.com`. Make sure to check your Jenkins controller is reachable from the agent.

Most probably the environment variable is passed over correctly.

---

<div class="post-metadata">

**Author:** ![rohitdalvi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/rohitdalvi/32/1396_2.png) [@rohitdalvi](https://community.jenkins.io/u/rohitdalvi)\
**Post date:** [April 28, 2022, 12:52pm UTC](https://community.jenkins.io/t/unable-to-start-inbound-agent-on-windows-server/2251/5 "2022-04-28T12:52:15Z")

</div>

Hi Marcin,

I can confirm that the agent can resolve the jenkins server because I am able to connect it using the agent.jar method. But it is the container which does not like the -WebSocket parameter. I tried the same thing in linux machine and I was able to connect the agent container to jenkins. And I am passing the same parameter they suggested on the wiki, but it is not working.

---

<div class="post-metadata">

**Author:** ![saper](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/saper/32/138_2.png) [@saper](https://community.jenkins.io/u/saper)\
**Post date:** [May 8, 2022, 5:00pm UTC](https://community.jenkins.io/t/unable-to-start-inbound-agent-on-windows-server/2251/6 "2022-05-08T17:00:29Z")

</div>

Can you give the invocation that works without `-WebSocket`?
