Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation of Environment Variables and Help With Docker Compose Please! #521

Open
JohnHind opened this issue Feb 6, 2024 · 5 comments

Comments

@JohnHind
Copy link

JohnHind commented Feb 6, 2024

This looks like very useful software, but can anyone help me with setting it up please!

What I want to achieve: I want a docker container running on a Raspberry Pi which will serve me a terminal in a remote browser onto the host operating system which is running the docker container.

What already works: I can get a remote SSH terminal (for example from VS Code) on 'pi@octosnap.local' with a known password.

What I have tried: After a lot of research and faffing about I determined that the following Docker Compose ought to work:

version:  "3"
services:
  wetty:
    image: wettyoss/wetty:latest
    container_name: wetty
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      - REMOTE_SSH_SERVER=host.docker.internal
    ports:
      - 3002:3000
    restart: unless-stopped

But when I point my remote browser at "http://octosnap.local:3002/wetty", I get the following:

0336df9ce175 login: pi
Password: 
Login incorrect
0336df9ce175 login: 

Ping host.docker.internal from a terminal within the Docker container works fine. I was also able to ssh pi@host.docker.internal from within the container although it did prompt me to accept the key fingerprint, but gave the correct pi@octosnap: command prompt.

Is it trying to connect to the wrong server? What does the hex string ahead of 'login' mean? Is the environment variable supported? I can find no documentation of environment variables here, but did find several sources for this around the Internet. If not, how can I pass the host address into the Docker container? Am I missing something else?

Help!

@Luigi600
Copy link

Is the environment variable supported? I can find no documentation of environment variables here

Clear and unequivocal: no.

As you can see from the README, the values are passed as program arguments. Therefore, you must use the arguments in your Docker Compose file instead of environment variables. The key word here is command. In your case, the file should look like this:

version:  "3"
services:
  wetty:
    image: wettyoss/wetty:latest
    container_name: wetty
    extra_hosts:
      - "host.docker.internal:host-gateway"
    command:
      - "--ssh-host"
      - "host.docker.internal"
    ports:
      - 3002:3000
    restart: unless-stopped

For example, `--ssh-user' and others can now be set in the same schema.

@JohnHind
Copy link
Author

Many thanks Luigi, that works nicely!

May I suggest it would be VERY useful to include this Docker Compose example in the README along with the Docker command line version? The absence of this caused me to Google it resulting in many examples using the environment variables. I have realized that WeTTY has gone through 'forking hell' with numerous undocumented versions in Docker Hub (many of them seem to have been abandoned years ago) and I guess some of them have added environment variable support. It might also be useful to acknowledge this and explicitly state that environment variables are NOT supported in this root version.

As another suggestion, the wettyoss/wetty documentation in Docker Hub needs improvement. It does not actually talk about running WeTTY under Docker at all! I guess it is a copy of an earlier version of the README from here. Just updating to the current version would at least mention Docker, but combine that with the above information for Docker Compose and we'd be where we need to be.

@JohnHind
Copy link
Author

Hm.. Spoke too soon! Damn thing worked once but since then it gives an ssh resolution error when I try to reconnect. I guess I need some SSH jujitsu as well!

@Luigi600
Copy link

Let's see what the maintainer says ;)

Do you have any more detailed error messages or a minimal example to reconstruct? I have so far only used wetty to access another container (Ubuntu) without any errors.

@JohnHind
Copy link
Author

Thanks again Luigi, turns out this was a problem with CasaOS not supporting the 'extra_hosts' section in the Docker Compose. I first built it in Portainer and it worked fine. Then I imported it into CasaOS which ingested the Docker Compose file and used it to rebuild the container. Since the whole purpose of this exercise is to migrate away from CasaOS (WeTTY being a replacement for CasaOS's web terminal functionality, which along with 'Filebrowser', should allow me to replace the dashboard functionality of CasaOS with 'Dashy') so this does not matter.
Thanks again for all your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants