linuxserver / docker-sonarr

GNU General Public License v3.0
795 stars 139 forks source link

Sonarr not reachable via localhost #221

Closed GAS85 closed 2 years ago

GAS85 commented 2 years ago

linuxserver.io


Expected Behavior

Run container and reach it via exposed port on a localhost, e.g.

curl http://localhost:8989

Current Behavior

Similar to https://github.com/linuxserver/docker-ombi/issues/97 and #165

Container is not accessible for a localhost machine with current configuration, nor reverse proxy, nor curl will works, only accessible from other containers, or other machines in network:

curl http://192.168.0.9:8989 -v -m 2 -I
*   Trying 192.168.0.9:8989...
* TCP_NODELAY set
* Connection timed out after 2001 milliseconds
* Closing connection 0
curl: (28) Connection timed out after 2001 milliseconds
###
curl http://localhost:8989 -v -m 2 -I
*   Trying 127.0.0.1:8989...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8989 (#0)
> HEAD / HTTP/1.1
> Host: localhost:8989
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Operation timed out after 2000 milliseconds with 0 bytes received
* Closing connection 0
curl: (28) Operation timed out after 2000 milliseconds with 0 bytes received

Steps to Reproduce

  1. Use docker compose with following configuration:
    services:
      sonarr:
        image: lscr.io/linuxserver/sonarr:latest
        container_name: sonarr
        environment:
          - PUID=${PUID}
          - PGID=${PGID}
          - TZ=${TZ}
        volumes:
          - ${WORKINGDIR}/docker/sonarr:/config
        ports:
          - 8989:8989
        restart: unless-stopped
  2. Check if port exposed and try to connect to it:

    
    $ docker ps -l
    CONTAINER ID   IMAGE                                  COMMAND                  CREATED             STATUS                    PORTS                                                                                                                                                                                                                                                                                                                NAMES
    19b316eef795   lscr.io/linuxserver/sonarr:latest      "/init"                  2 days ago          Up 2 days                 0.0.0.0:8989->8989/tcp, :::8989->8989/tcp                                                                                                                                                                                                                                                                            sonarr
    
    $ curl http://localhost:8989 
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
      0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0

Environment

OS: Ubuntu 20.04 CPU architecture: x86_64 How docker service was installed: from the official docker repo Docker version: 20.10.13

Command used to create docker container (run/create/compose/screenshot)

docker-compose -f /var/docker/docker-compose.yaml up -d

content of /var/docker/docker-compose.yaml is above.

Docker logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 01-migrations: executing... 
[migrations] started
[migrations] no migrations found
[cont-init.d] 01-migrations: exited 0.
[cont-init.d] 02-tamper-check: executing... 
[cont-init.d] 02-tamper-check: exited 0.
[cont-init.d] 10-adduser: executing... 

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
-------------------------------------

To support the app dev(s) visit:
Sonarr: https://sonarr.tv/donate

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1001
User gid:    998
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 30-config: executing... 
[cont-init.d] 30-config: exited 0.
[cont-init.d] 90-custom-folders: executing... 
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-scripts: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-scripts: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[Info] Bootstrap: Starting Sonarr - /app/sonarr/bin/Sonarr.exe - Version 3.0.8.1507 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Info] Router: Application mode: Interactive 
[Info] MigrationLogger: *** Checking database for required migrations data source=/config/sonarr.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 *** 
[Info] MigrationLogger: *** Checking database for required migrations data source=/config/logs.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 *** 
[Info] OwinHostController: Listening on the following URLs: 
[Info] OwinHostController:   http://*:8989/ 
[Info] SonarrBootstrapper: Starting Web Server 
github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

aptalca commented 2 years ago

Container is up, and it's accessible by other machines (aka accessible via host IP and port) so there is no issue or bug that I can see.

We never advertise access via localhost.

Closing

GAS85 commented 2 years ago

Hi would like to ask you to open this ticket again, because original issue was not solved.

So if I would like to expose this service with e.g. apache:

#Sonarr
Redirect 301 "/sonarr" "/sonarr/"
    <Location /sonarr/>
        ProxyPass http://localhost:8989/ retry=0 timeout=5
        ProxyPassReverse http://localhost:8989/
        RequestHeader set Connection ""
    </Location>

This will never work.

GAS85 commented 2 years ago

For example it works very good with https://github.com/linuxserver/docker-dokuwiki, it is accessible by my Host Machine via exposed port:

curl http://localhost:9014 -v > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1:9014...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9014 (#0)
> GET / HTTP/1.1
> Host: localhost:9014
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.18.0
< Date: Fri, 27 May 2022 20:12:46 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/7.4.26
< Vary: Cookie
< Set-Cookie: DokuWiki=XXXXXXXXXXXXX; path=/; HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
< Set-Cookie: XXXXXXXXX=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
< X-UA-Compatible: IE=edge,chrome=1
< 
{ [7764 bytes data]
100 37462    0 37462    0     0   475k      0 --:--:-- --:--:-- --:--:--  475k
* Connection #0 to host localhost left intact

The same I expect from other containers.

aptalca commented 2 years ago

Github issues is for bug reports. This is not a bug. There are other channels for support.