title: Apache Guacamole in Docker containers: Creation of WebSocket tunnel to guacd failed
body: <p>I installed Apache Guacamole using Docker on a CentOS 8.1 with Docker 19.03.</p>
  
  <p>I followed the steps described here:</p>
  
  <ul>
  <li><p><a href="https://guacamole.apache.org/doc/gug/guacamole-docker.html" rel="nofollow noreferrer">https://guacamole.apache.org/doc/gug/guacamole-docker.html</a></p></li>
  <li><p><a href="https://www.linode.com/docs/applications/remote-desktop/remote-desktop-using-apache-guacamole-on-docker/" rel="nofollow noreferrer">https://www.linode.com/docs/applications/remote-desktop/remote-desktop-using-apache-guacamole-on-docker/</a></p></li>
  </ul>
  
  <p>I started the containers like this:</p>
  
  <pre class="lang-sh prettyprint-override"><code># mysql container
  docker run --name guacamole-mysql -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_ONETIME_PASSWORD=yes -d mysql/mysql-server
  
  # guacd container
  docker run --name guacamole-guacd -e GUACD_LOG_LEVEL=debug -d guacamole/guacd
  
  # guacamole container
  docker run --name guacamole-guacamole --link guacamole-guacd:guacd --link guacamole-mysql:mysql -e MYSQL_DATABASE=guacamole -e MYSQL_USER=guacamole -e MYSQL_PASSWORD=password -d -p 8080:8080 guacamole/guacamole
  </code></pre>
  
  <p>All went fine and I was able to access the Guacamole web interface on port 8080. I configured one VNC connection to another machine on port 5900. Unfortunately when I try to use that connection I get the following error in the web interface:</p>
  
  <p>"An internal error has occurred within the Guacamole server, and the connection has been terminated..."</p>
  
  <p>I had a look on the logs too and in the guacamole log I found this:</p>
  
  <pre class="lang-sh prettyprint-override"><code>docker logs --tail all -f guacamole-guacamole
  ...
  15:54:06.262 [http-nio-8080-exec-2] ERROR o.a.g.w.GuacamoleWebSocketTunnelEndpoint - Creation of WebSocket tunnel to guacd failed: End of stream while waiting for "args".
  15:54:06.685 [http-nio-8080-exec-8] ERROR o.a.g.s.GuacamoleHTTPTunnelServlet - HTTP tunnel request failed: End of stream while waiting for "args".
  </code></pre>
  
  <p>I'm sure that the target machine (which is running the VNC server) is fine. I'm able to connect to it from both a VNC client and another older Guacamole which I installed previously (not using Docker).</p>
  
  <p>My containers look ok too:</p>
  
  <pre class="lang-sh prettyprint-override"><code>docker container ps
  
  CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                 PORTS                    NAMES
  ad62aaca5627        guacamole/guacamole   "/opt/guacamole/bin/…"   About an hour ago   Up About an hour       0.0.0.0:8080-&gt;8080/tcp   guacamole-guacamole
  a46bd76234ea        guacamole/guacd       "/bin/sh -c '/usr/lo…"   About an hour ago   Up About an hour       4822/tcp                 guacamole-guacd
  ed3a590b19d3        mysql/mysql-server    "/entrypoint.sh mysq…"   2 hours ago         Up 2 hours (healthy)   3306/tcp, 33060/tcp      guacamole-mysql
  </code></pre>
  
  <p>I connected to the guacamole-guacamole container and pinged the other two containers: guacamole-mysql and guacamole-guacd. Both look fine and reachable.</p>
  
  <pre class="lang-sh prettyprint-override"><code>docker exec -it guacamole-guacamole bash
  
  root@ad62aaca5627:/opt/guacamole# ping guacd
  PING guacd (172.17.0.2) 56(84) bytes of data.
  64 bytes from guacd (172.17.0.2): icmp_seq=1 ttl=64 time=0.191 ms
  64 bytes from guacd (172.17.0.2): icmp_seq=2 ttl=64 time=0.091 ms
  
  root@ad62aaca5627:/opt/guacamole# ping mysql
  PING mysql (172.17.0.3) 56(84) bytes of data.
  64 bytes from mysql (172.17.0.3): icmp_seq=1 ttl=64 time=0.143 ms
  64 bytes from mysql (172.17.0.3): icmp_seq=2 ttl=64 time=0.102 ms
  </code></pre>
  
  <p>Looks like there is a communication issue between the guacamole itself and guacd. And this is where I'm completely stuck.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried on CentOS 7 and I got the same issues.</p>
  
  <p>I also tried this solution <a href="https://github.com/boschkundendienst/guacamole-docker-compose" rel="nofollow noreferrer">https://github.com/boschkundendienst/guacamole-docker-compose</a> as suggested by @BatchenRegev but I got the same issue again.</p>