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

Using kunde21/gitea-arm:v1.13.1 on linux/arm/v7 getting Bind to port 22 on 0.0.0.0 failed: Address in use. #7

Open
klmcwhirter opened this issue Jan 17, 2021 · 2 comments

Comments

@klmcwhirter
Copy link

Running kunde21/gitea-arm:v1.13.1 in portainer (part of OMV 5 install) on raspberry pi 4b.

I am getting the following error in the container log:

Could not load host certificate "/data/ssh/ssh_host_ed25519_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_rsa_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_ecdsa_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_dsa_cert": No such file or directory
Bind to port 22 on :: failed: Address in use.
Bind to port 22 on 0.0.0.0 failed: Address in use.
Cannot bind any address.

i do see that openssh is running:

ash-5.0# ps aux
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/s6-svscan /etc/s6
   17 root      0:12 s6-supervise openssh
   18 root      0:00 s6-supervise gitea
   20 git       1:16 /app/gitea/gitea web
  274 root      0:00 bash
 1114 git       0:00 bash
 6020 git       0:00 bash
21396 root      0:00 bash
21530 root      0:00 ps aux
bash-5.0# 

And port 22 is open and someone is listening:

ash-5.0# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 localhost:32401         0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.53:domain       0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN

However when i look at docker ps I notice no ports being announced. May be a portainer thing.

klmcw@pinas1:~ $ docker ps
CONTAINER ID   IMAGE                                     COMMAND                  CREATED          STATUS          PORTS                                            NAMES
8e60b710dc2b   kunde21/gitea-arm:v1.13.1                 "/usr/bin/entrypoint…"   53 minutes ago   Up 53 minutes                                                    gitea
40aa4f207472   ghcr.io/linuxserver/plex:arm32v7-bionic   "/init"                  3 weeks ago      Up 7 hours                                                       plex
df8a503b52c3   portainer/portainer-ce                    "/portainer"             3 weeks ago      Up 7 hours      0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp   portainer

The portainer UI does recognize the EXPOSEd ports correctly: 22 3000.

But I wanted to check with you first to make sure I am using your docker image correctly.

Note I am using a modified version of your docker-compose.yml.

Mine looks like this:

---
version: "2.1"
services:
  gitea:
    image: kunde21/gitea-arm:v1.13.1
    container_name: gitea
    network_mode: host
    environment:
      - USER_UID=1022
      - USER_GID=1022
    ports: 
      - "3000:3000"
      - "127.0.0.1:1022:22"
    volumes:
      - /srv/dev-disk-by-label-RAID1/gitea:/data
      - /home/git/.ssh/:/data/git/.ssh
    restart: unless-stopped

I did follow the instructions at SSH container passthrough.
However, this has no effect, of course, unless something is listening on the host port (1022 in my case).

Do you have any ideas? Am I missing something starting your image?

Thanks.
-k

@klmcwhirter
Copy link
Author

Forgot to mention I have tried both DISABLE_SSH = true and DISABLE_SSH = false in /data/gitea/conf/app.ini

The SSH_PORT = 22 and SSH_LISTEN_PORT = 22 have been kept at their default values.

The only edits i have made to this file are as follows to match my architecture.

[server]
...
DOMAIN           = pinas1
SSH_DOMAIN       = pinas1
HTTP_PORT        = 3000
ROOT_URL         = http://pinas1:3000/
...

@Kunde21
Copy link
Owner

Kunde21 commented Jan 20, 2021

I haven't attempted this setup, to be honest. The gitea forum or discord might be a better source of advice on it. I've done nothing to change the config or ssh server in this image, so I doubt it's specific to the image.

Having said that, the first thing that jumps out at me is you're attempting to bind to a low port while running as non-root (1022:1022) user. Try using a high port inside the container, in case that's the issue:
SSH_PORT = 2222 and

    ports: 
      - "3000:3000"
      - "127.0.0.1:1022:2222"

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