简体   繁体   中英

Access to a Docker Gitlab instance from the network

I'm installing a Gitlab instance with docker-compose on a server machine on my local network, and I'd like to access to my Gitlab instance from anywhere in my local network by visiting for example " https://my-hostname "

I follow this .

I'm running:

web:
  image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.example.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.example.com'
      # Add any other gitlab.rb configuration here, each on its own line
  ports:
    - '7780:80'
    - '7443:443'
    - '7722:22'
  volumes:
    - '/srv/gitlab/config:/etc/gitlab'
    - '/srv/gitlab/logs:/var/log/gitlab'
    - '/srv/gitlab/data:/var/opt/gitlab'

Now I have very (very) limited network knowledge, so basically, how do I access to my running gitlab instance ? When I go to the local network IP of my host, my browser tells me that it can't connect.

Here is what I'm hoping to achieve:

 LOCAL NETWORK
 +--------------------------------------------------------------------------+
 |                                                                          |
 |   +--------------------+                                                 |
 |   |     My_Server      |                                                 |
 |   |                    |                                                 |
 |   | +----------------+ |                                                 |
 |   | |                | |  "https://my-hostname" +-------------------+    |
 |   | | Docker: Gitlab | <------------------------+     My_Client     |    |
 |   | |                | |                        +-------------------+    |
 |   | +----------------+ |                                                 |
 |   |                    |                                                 |
 |   +--------------------+                                                 |
 |                                                                          |
 +--------------------------------------------------------------------------+

The ports part of your configuration maps the host's ports to the container's ports.

So if you have

ports: - '7780:80' - '7443:443' - '7722:22'

that is redirecting port 7780 on your host to port 80 on your container, and so forth. You should be able to access your container's services (via its local IP address, and then its hostname via local DNS) with this knowledge.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM