2
I have a running gitlab container. The run command:
sudo docker run --detach \
--hostname gitlab.domain.com \
--publish 8888:80 --publish 2222:22 \
--name gitlab \
--restart always \
--volume /home/apps/gitlab/config:/etc/gitlab \
--volume /home/apps/gitlab/logs:/var/log/gitlab \
--volume /home/apps/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
The gitlab app is running fine and is accessible on a local network from browser by entering http://192.168.1.141:8888. (server's internal IP and port defined in docker run)
PORTS part of docker ps -a
:
443/tcp, 0.0.0.0:2222->22/tcp, 0.0.0.0:8888->80/tcp
Open ports on the server:
~$ netstat -l | grep 8888
tcp6 0 0 [::]:8888 [::]:* LISTEN
I added 192.168.1.141 gitlab.domain.com
to /etc/hosts
on my computer and wanted to set a proxy in apache which is running on server port 80.
My idea was to view the gitlab site only by entering gitlab.domain.com
.
I was not successful so I tried to curl the container from the host server. Neither of these worked:
curl http://localhost:8888
curl http://192.168.1.141:8888
Result:
~$ curl http://localhost:8888 -v
* Trying 127.0.0.1:8888...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8888 (#0)
> GET / HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/7.66.0
> Accept: */*
>
Any idea why this is happening? How to connect from the host server to the gitlab page?
If I do curl 192.168.1.141:8888
from my PC, it works:
$ curl 192.168.1.141:8888 -v
* Rebuilt URL to: 192.168.1.141:8888/
* Trying 192.168.1.141...
* TCP_NODELAY set
* Connected to 192.168.1.141 (192.168.1.141) port 8888 (#0)
> GET / HTTP/1.1
> Host: 192.168.1.141:8888
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Server: nginx
< Date: Sun, 03 Nov 2019 16:27:53 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 105
< Connection: keep-alive
< Cache-Control: no-cache
< Location: http://192.168.1.141:8888/users/sign_in
< Referrer-Policy: strict-origin-when-cross-origin
< Set-Cookie: experimentation_subject_id=ImQyMThkOWI4LWM2MjQtNGM5ZS1hOTZiLTc4YTFhN2U3YjhmNSI%3D--a9d45810de1608210d337df71cbad8c0ac10de16; path=/; expires=Thu, 03 Nov 2039 16:27:53 -0000
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Frame-Options: DENY
< X-Permitted-Cross-Domain-Policies: none
< X-Request-Id: LnCSv7rcW6a
< X-Runtime: 0.010182
< X-Ua-Compatible: IE=edge
< X-Xss-Protection: 1; mode=block
< Strict-Transport-Security: max-age=31536000
< Referrer-Policy: strict-origin-when-cross-origin
<
* Connection #0 to host 192.168.1.141 left intact
<html><body>You are being <a href="http://192.168.1.141:8888/users/sign_in">redirected</a>.</body></html>