Gitea SSH_LISTEN_PORT hardcoded in docker container? #2357

Closed
opened 2025-11-02 04:33:45 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @laymonk on GitHub (Sep 26, 2018).

  • Gitea version (or commit ref): 36e7cb9

  • Git version: not relevant

  • Operating system: Ubuntu 18.04 (Docker Container)

  • Database (use [x]):

    • MySQL - MariaDB 10.2
  • Can you reproduce the bug at https://try.gitea.io:

  • Not relevant

  • Log gist:

Description

  • I am trying to get ssh listening on port 2222, but the logs show that the server is listening on 22.
  • I have not forwarded port 22, but this shows up as forwarded
  • The docker port-forwarding 2222:2222 is fine and the port is available.
  • This means that gitea is ignoring the settings in app.ini and listening on 22
    ...

Screenshots

  • app.ini
DISABLE_SSH      = false
START_SSH_SERVER = true
SSH_PORT         = 2222
SSH_LISTEN_PORT  = 2222
  • snippets from docker inspect
"Config": {
            "Hostname": "b7000ad29aa3",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "2222/tcp": {},
                "22/tcp": {},
                "3000/tcp": {}
            },

.... 
"NetworkSettings": {
            "Bridge": "",
            "SandboxID": "0515f57a378a288e03f0ea11b2dd4f998ad2efff7641b02374aba2858f87e662",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "2222/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "2222"
                    }
                ],
                "22/tcp": null,
                "3000/tcp": null
            },
  • snippets from docker-compose logs
gitea_1      | Sep 26 12:11:25 syslogd started: BusyBox v1.27.2
gitea_1      | Sep 26 12:11:25 sshd[16]: Server listening on :: port 22.
gitea_1      | Sep 26 12:11:25 sshd[16]: Server listening on 0.0.0.0 port 22.
Originally created by @laymonk on GitHub (Sep 26, 2018). - Gitea version (or commit ref): 36e7cb9 - Git version: not relevant - Operating system: Ubuntu 18.04 (Docker Container) - Database (use `[x]`): - [x] MySQL - MariaDB 10.2 - Can you reproduce the bug at https://try.gitea.io: - [x] Not relevant - Log gist: ## Description * I am trying to get ssh listening on port 2222, but the logs show that the server is listening on 22. * `I have not forwarded port 22, but this shows up as forwarded` * The docker port-forwarding 2222:2222 is fine and the port is available. * This means that gitea is ignoring the settings in app.ini and listening on 22 ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** --> * app.ini ``` DISABLE_SSH = false START_SSH_SERVER = true SSH_PORT = 2222 SSH_LISTEN_PORT = 2222 ``` * snippets from `docker inspect` ``` "Config": { "Hostname": "b7000ad29aa3", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "2222/tcp": {}, "22/tcp": {}, "3000/tcp": {} }, .... "NetworkSettings": { "Bridge": "", "SandboxID": "0515f57a378a288e03f0ea11b2dd4f998ad2efff7641b02374aba2858f87e662", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "2222/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "2222" } ], "22/tcp": null, "3000/tcp": null }, ``` * snippets from docker-compose logs ``` gitea_1 | Sep 26 12:11:25 syslogd started: BusyBox v1.27.2 gitea_1 | Sep 26 12:11:25 sshd[16]: Server listening on :: port 22. gitea_1 | Sep 26 12:11:25 sshd[16]: Server listening on 0.0.0.0 port 22. ```
GiteaMirror added the type/question label 2025-11-02 04:33:45 -06:00
Author
Owner

@lafriks commented on GitHub (Sep 26, 2018):

Gitea Docker image currently has built in OpenSSH server, it is planned to change that to internal in the future

@lafriks commented on GitHub (Sep 26, 2018): Gitea Docker image currently has built in OpenSSH server, it is planned to change that to internal in the future
Author
Owner

@sapk commented on GitHub (Sep 27, 2018):

@laymonk You can define the port forwarding like -p 22:2222. The openssh server will listen on 22 but exposed on 2222 by docker. The ssh links in gitea will be in :2222.

@sapk commented on GitHub (Sep 27, 2018): @laymonk You can define the port forwarding like -p 22:2222. The openssh server will listen on 22 but exposed on 2222 by docker. The ssh links in gitea will be in :2222.
Author
Owner

@laymonk commented on GitHub (Oct 11, 2018):

Apologies for belatedly coming back to this. Been tied up. I worked around this problem, had to deploy additional IP addresses. Thanks for your support.

@laymonk commented on GitHub (Oct 11, 2018): Apologies for belatedly coming back to this. Been tied up. I worked around this problem, had to deploy additional IP addresses. Thanks for your support.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2357