hello I have build the image based on [1] it builds and runs, it creates in the container the jupyter server, and prints the adress port and token required to connect (locally I just paste the adress like below and it works)
http://127.0.0.1:8888/?token=...
Hovewer As GCP is not a local machine and it has default ssh connection here I struggle how to open the connection to jupyter lab in order to be able to develop inside the container on gcp
Thanks For Help!
[1] https://github.com/Slicer/SlicerDocker
Solved! Go to Solution.
Ah, I think you might have the ports the wrong way round, you are listening locally on 8888 and then trying to connect to jupyter on 22222 and so it's failing because it is expecting connections on 8888, if you swap the ports around on the command does that work better?
Hi,
You would need to look to SSH port forwarding to achieve what you are doing. This uses an SSH connection to tunnel a local port on your machine over SSH and forward the connections to a port on the remote server.
There are instructions on how to do this using Google Cloud CLI tooling here:
Thank You @alexmoore
So for reference I invoke
gcloud compute ssh VM_NAME \ --project PROJECT_ID \ --zone ZONE \ -- -NL LOCAL_PORT:localhost:REMOTE_PORT
with remote port 8888 one exposed in docker and on which I can find jupyterlab (http://127.0.0.1:8888/?token=...)
local port - for example 2222
and I should be able to access jupyter via http://localhost:2222/
but we get
bind [::1]:8888: Cannot assign requested address
also how to pass token? like locally so just pass the token after adress in a browser window?
From the error it looks like it is trying to bind using IPv6, you could try adding a '4' to the command line:
gcloud compute ssh VM_NAME \ --project PROJECT_ID \ --zone ZONE \ -- -4NL LOCAL_PORT:localhost:REMOTE_PORT
Regarding the token, it looks from the page you shared to be passed in the URL when you access the application.
Thanks @alexmoore for this tip Hovewer when I am trying it I get information that
Waiting for SSH key to propagate ...
And nothing happens next I wait an hour ussually I loose connection reset ssh but still nothing happens then trying locally connection by
http://127.0.0.1:8888/?token=...
I get no connection
As the alternative I considered the remote chrome desktop connection but after setting up either with xcfe or gnome after giving command
sudo systemctl status chrome-remote-desktop@$USER
I always get error
vm-nvidia-gpu-v100-vm2-vm chrome-remote-desktop[2344]: xdpyinfo: unable to open display ":20".
Thank toy for any guidance !
I think you might find that it was working but that you don't end up in an interactive shell - the "N" in the command line tells it not to open a shell. If you further add a "v" you will get the logs of the connection and that should show you the forwarding being configured, so try:
gcloud compute ssh VM_NAME \ --project PROJECT_ID \ --zone ZONE \ -- -v4NL LOCAL_PORT:localhost:REMOTE_PORT
I get now
OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 34.91.51.162 [34.91.51.162] port 22.
debug1: Connection established.
debug1: identity file /home/jakub/.ssh/google_compute_engine type 0
debug1: identity file /home/jakub/.ssh/google_compute_engine-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 34.91.51.162:22 as 'jakub'
debug1: using hostkeyalias: compute.9156550384768265985
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:kEXzW1Qwb+6DKZl9KHHUvmXx7TRxWqGziKxoakuqqDo
debug1: using hostkeyalias: compute.9156550384768265985
debug1: Host 'compute.9156550384768265985' is known and matches the ECDSA host key.
debug1: Found key in /home/jakub/.ssh/google_compute_known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/jakub/.ssh/google_compute_engine RSA SHA256:6zlo8Lr1FqjYmaTW8zySDf0bb/oHNcMOzOs80Wkl/dg explicit agent
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/jakub/.ssh/google_compute_engine RSA SHA256:6zlo8Lr1FqjYmaTW8zySDf0bb/oHNcMOzOs80Wkl/dg explicit agent
debug1: Server accepts key: /home/jakub/.ssh/google_compute_engine RSA SHA256:6zlo8Lr1FqjYmaTW8zySDf0bb/oHNcMOzOs80Wkl/dg explicit agent
debug1: Authentication succeeded (publickey).
Authenticated to 34.91.51.162 ([34.91.51.162]:22).
debug1: Local connections to LOCALHOST:8888 forwarded to remote address localhost:22222
debug1: Local forwarding listening on 127.0.0.1 port 8888.
debug1: channel 0: new [port listener]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Remote: /home/jakub/.ssh/authorized_keys:2: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /home/jakub/.ssh/authorized_keys:2: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 2: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37462 to 127.0.0.1 port 8888, nchannels 3
debug1: channel 2: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37464 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37466 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 2: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37468 to 127.0.0.1 port 8888, nchannels 3
debug1: channel 2: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37470 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37472 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 2: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37474 to 127.0.0.1 port 8888, nchannels 3
debug1: channel 2: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37476 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37478 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 2: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37480 to 127.0.0.1 port 8888, nchannels 3
debug1: channel 2: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37482 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37484 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 2: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37486 to 127.0.0.1 port 8888, nchannels 3
debug1: channel 2: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37490 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37492 to 127.0.0.1 port 8888, nchannels 2
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 2: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37494 to 127.0.0.1 port 8888, nchannels 3
debug1: channel 2: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37496 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37498 to 127.0.0.1 port 8888, nchannels 2
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 2: new [direct-tcpip]
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
channel 1: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37508 to 127.0.0.1 port 8888, nchannels 3
debug1: channel 2: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37510 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37512 to 127.0.0.1 port 8888, nchannels 2
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 2: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37514 to 127.0.0.1 port 8888, nchannels 3
debug1: channel 2: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37516 to 127.0.0.1 port 8888, nchannels 2
debug1: Connection to port 8888 forwarding to localhost port 22222 requested.
debug1: channel 1: new [direct-tcpip]
channel 1: open failed: connect failed: Connection refused
debug1: channel 1: free: direct-tcpip: listening port 8888 for localhost port 22222, connect from 127.0.0.1 port 37518 to 127.0.0.1 port 8888, nchannels 2
debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1
Ah, I think you might have the ports the wrong way round, you are listening locally on 8888 and then trying to connect to jupyter on 22222 and so it's failing because it is expecting connections on 8888, if you swap the ports around on the command does that work better?
Thanks it was so simple - yes !!
Hurray! 🙂