Docker Community Forums

Share and learn in the Docker community.

I want to connect the bin/bash of the docker container to the web socket

swarm

#1

I am creating a project that can use the terminal with xterm.js.
I have only a piece of knowledge at https://docs.docker.com/ee/ucp/interlock/usage/websockets/ and I can not confirm the details.

$ sudo docker service create \
>     --name demo \
>     --network demo \
>     --detach=false \
>     --label com.docker.lb.hosts=demolocal \
>     --label com.docker.lb.port=8080 \
>     --label com.docker.lb.websocket_endpoints=/ws \
> alpine:latest
o35mog3xhe57peazfimlu0ycw
overall progress: 0 out of 1 tasks 
1/1: starting  [============================================>      ] 
verify: Detected task failure 

The alpine linux image I’m trying to connect seems to require something to set, but I can not find the contents.

This is the log output of the docker service command I tried.
No errors found.

sudo docker inspect ka0p5ux923gw
[
    {
        "ID": "ka0p5ux923gway2fzn3kcoswo",
        "Version": {
            "Index": 11210
        },
        "CreatedAt": "2019-01-23T09:53:25.077957505Z",
        "UpdatedAt": "2019-01-23T09:53:33.958602543Z",
        "Labels": {},
        "Spec": {
            "ContainerSpec": {
                "Image": "alpine:latest@sha256:46e71df1e5191ab8b8034c5189e325258ec44ea739bba1e5645cff83c9048ff1",
                "Init": false,
                "DNSConfig": {},
                "Isolation": "default"
            },
            "Resources": {
                "Limits": {},
                "Reservations": {}
            },
            "Placement": {
                "Platforms": [
                    {
                        "Architecture": "amd64",
                        "OS": "linux"
                    },
                    {
                        "OS": "linux"
                    },
                    {
                        "Architecture": "arm64",
                        "OS": "linux"
                    },
                    {
                        "Architecture": "386",
                        "OS": "linux"
                    },
                    {
                        "Architecture": "ppc64le",
                        "OS": "linux"
                    },
                    {
                        "Architecture": "s390x",
                        "OS": "linux"
                    }
                ]
            },
            "Networks": [
                {
                    "Target": "mry47ehd8f8s0skio7yrsycac"
                }
            ],
            "ForceUpdate": 0
        },
        "ServiceID": "o35mog3xhe57peazfimlu0ycw",
        "Slot": 1,
        "NodeID": "nd3sxmb2yihia6mdurk7iy1of",
        "Status": {
            "Timestamp": "2019-01-23T09:53:33.745859264Z",
            "State": "complete",
            "Message": "finished",
            "ContainerStatus": {
                "ContainerID": "0f8572bff30c29c96f875ec6058974f74e564f0d63c8f50139f87b5c8f97d934",
                "PID": 0,
                "ExitCode": 0
            },
            "PortStatus": {}
        },
        "DesiredState": "shutdown",
        "NetworksAttachments": [
            {
                "Network": {
                    "ID": "mry47ehd8f8s0skio7yrsycac",
                    "Version": {
                        "Index": 12
                    },
                    "CreatedAt": "2019-01-23T06:48:14.389844579Z",
                    "UpdatedAt": "2019-01-23T06:48:14.390795856Z",
                    "Spec": {
                        "Name": "demo",
                        "Labels": {},
                        "DriverConfiguration": {
                            "Name": "overlay"
                        },
                        "Attachable": true,
                        "IPAMOptions": {
                            "Driver": {
                                "Name": "default"
                            }
                        },
                        "Scope": "swarm"
                    },
                    "DriverState": {
                        "Name": "overlay",
                        "Options": {
                            "com.docker.network.driver.overlay.vxlanid_list": "4097"
                        }
                    },
                    "IPAMOptions": {
                        "Driver": {
                            "Name": "default"
                        },
                        "Configs": [
                            {
                                "Subnet": "10.0.0.0/24",
                                "Gateway": "10.0.0.1"
                            }
                        ]
                    }
                },
                "Addresses": [
                    "10.0.0.106/24"
                ]
            }
        ]
    }
]

I have no knowledge of the technology.
Anyone to help?


(Metin Y.) #2

Interlock is a Layer7 Loadbalancer provided by Docker-EE standard and advanced. The labels you did set are specific to the Interlock loadbalancer.

Unless you created a web application that provides access to the terminal via websockets and runs inside a container, the loadbalancer won’t be of any help.


#3

As a result of my Googleing, I found that I had to configure a web socket in the docker.
The explanation for the interlock solved my question, and I am grateful for the concise and accurate answer.