BEGINNERS: Docker example redirects to non-existing URL after setup unless properly configured #1287

Closed
opened 2025-11-02 03:55:34 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @HenrikBengtsson on GitHub (Nov 27, 2017).

(moved from https://github.com/go-gitea/docs/issues/173)

Background

The instructions at https://docs.gitea.io/en-us/install-with-docker/ that launched Gitea using

docker run -d --name=gitea -p 10022:22 -p 10080:3000 -v /var/lib/gitea:/data gitea/gitea:latest

informs the user that the web UI is available at http://hostname:10080/. When one goes there, one is redirected to http://hostname:10080/install for "Initial configuration". So far so good. Next, when one clicks 'Install Gitea' the browser is redirected to http://localhost:3000/user/login.

Issue

If localhost != hostname (e.g. running on a remote machine), this causes the browser to throw an error that the URL is non-existing. This is confusing to someone who is trying out Gitea for the first time (or coming back to a new setup). The workaround that a user might try is to go back to http://hostname:10080/, which then takes you to the Gitea front page. At this stage it is not clear to the user whether this was a hickup in Gitea or they hacked Gitea into a semi-working state ("will this come and haunt me later or am I good?").

I assume the proper solution is for the user to configure Gitea using:

At least when doing so, the browser is correctly redirected to http://hostname:10080/user/login.

What is not clear to me is if SSH Port and/or HTTP Port should be changed from 22 and 3000 to 10022 and 10080 as well. Is there a need for 'HTTP URL' and 'SSH URL' settings too to distinguish between internal Docker ports and publicly facing ports?

Proposal

Clarify on https://docs.gitea.io/en-us/install-with-docker/ how to configure Gitea in the initial setup.

(Should this issue be addressed to https://github.com/go-gitea/gitea instead?)

Originally created by @HenrikBengtsson on GitHub (Nov 27, 2017). (moved from https://github.com/go-gitea/docs/issues/173) # Background The instructions at https://docs.gitea.io/en-us/install-with-docker/ that launched Gitea using ```sh docker run -d --name=gitea -p 10022:22 -p 10080:3000 -v /var/lib/gitea:/data gitea/gitea:latest ``` informs the user that the web UI is available at http://hostname:10080/. When one goes there, one is redirected to http://hostname:10080/install for "Initial configuration". So far so good. Next, when one clicks 'Install Gitea' the browser is redirected to http://localhost:3000/user/login. # Issue If `localhost != hostname` (e.g. running on a remote machine), this causes the browser to throw an error that the URL is non-existing. This is confusing to someone who is trying out Gitea for the first time (or coming back to a new setup). The workaround that a user might try is to go back to http://hostname:10080/, which then takes you to the Gitea front page. At this stage it is not clear to the user whether this was a hickup in Gitea or they hacked Gitea into a semi-working state ("will this come and haunt me later or am I good?"). I assume the proper solution is for the user to configure Gitea using: * Domain: hostname [...] * Application URL: http://hostname:10080/ At least when doing so, the browser is correctly redirected to http://hostname:10080/user/login. What is not clear to me is if **SSH Port** and/or **HTTP Port** should be changed from 22 and 3000 to 10022 and 10080 as well. Is there a need for 'HTTP URL' and 'SSH URL' settings too to distinguish between internal Docker ports and publicly facing ports? # Proposal Clarify on https://docs.gitea.io/en-us/install-with-docker/ how to configure Gitea in the initial setup. (Should this issue be addressed to https://github.com/go-gitea/gitea instead?)
GiteaMirror added the type/question label 2025-11-02 03:55:34 -06:00
Author
Owner

@HenrikBengtsson commented on GitHub (Nov 27, 2017):

Pasting in @techknowlogick's reply from gitea/docs:

Thanks for opening up this ticket @HenrikBengtsson 😄

These are really good questions that you are asking, inside the docker container the ports should remain 3000 for HTTP and 22 for SSH (if you are running docker via the docker run command listed in the documentation). This is due to docker remapping those ports to 10080 and 10022 respectively (the -p 10022:22 -p 10080:3000 part of the docker run command).

This repo has been deprecated (as of yesterday), and the docs are now being managed in the main gitea repo.

@HenrikBengtsson commented on GitHub (Nov 27, 2017): Pasting in @techknowlogick's [reply from gitea/docs](https://github.com/go-gitea/docs/issues/173#issuecomment-347292201): Thanks for opening up this ticket @HenrikBengtsson :smile: These are really good questions that you are asking, inside the docker container the ports should remain 3000 for HTTP and 22 for SSH (if you are running docker via the docker run command listed in the documentation). This is due to docker remapping those ports to 10080 and 10022 respectively (the -p 10022:22 -p 10080:3000 part of the docker run command). This repo has been deprecated (as of yesterday), and the docs are now being managed in the main gitea repo.
Author
Owner

@techknowlogick commented on GitHub (Nov 29, 2017):

Hi @HenrikBengtsson,

The docs site has been updated to the most recent version of the docs. Hopefully they are now more clear.

@techknowlogick commented on GitHub (Nov 29, 2017): Hi @HenrikBengtsson, The docs site has been updated to the most recent version of the docs. Hopefully they are now more clear.
Author
Owner

@lunny commented on GitHub (Nov 29, 2017):

see #2270, change app.ini

LOCAL_ROOT_URL  = http://localhost:3000/
@lunny commented on GitHub (Nov 29, 2017): see #2270, change app.ini ```ini LOCAL_ROOT_URL = http://localhost:3000/ ```
Author
Owner

@techknowlogick commented on GitHub (Feb 4, 2019):

Closing issue, as docs have been updated. Please open a post in the forum if this is still an issue.

@techknowlogick commented on GitHub (Feb 4, 2019): Closing issue, as docs have been updated. Please open a post in the [forum](https://discourse.gitea.io/) if this is still an issue.
Author
Owner

@zeripath commented on GitHub (Feb 4, 2019):

Hmm actually I wonder if we can do better: the docker instance should suggest the up address of the docker instead of localhost by default.

It's very annoying to have to remember to change this every time you download an instance to check it.

Would making this change affect tests?

@zeripath commented on GitHub (Feb 4, 2019): Hmm actually I wonder if we can do better: the docker instance should suggest the up address of the docker instead of localhost by default. It's very annoying to have to remember to change this every time you download an instance to check it. Would making this change affect tests?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1287