Accessing gitlab inside docker container from local machine
<p>I am trying to set up gitlab inside a docker container, where my docker container is running on a remote CentOS 7 server. Apparently, gitlab is running just fine because I can access the container and perform wget and also from the server. However, I cannot do the wget from my local machine. I would like to configure it so that I can access from anywhere, but I have no idea how to do this configuration or what it's missing. </p>

<p>I created the docker container like this:</p>

<blockquote>
  <p>sudo docker run --detach --hostname gitlab.example.com --publish 18080:80 --publish 12222:22 --publish 1443:443 --name gitlab --restart always --volume /srv/gitlab/config:/etc/gitlab --volume /srv/gitlab/logs:/var/log/gitlab --volume /srv/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest</p>
</blockquote>

<p>just as the official documentation <a href="http://doc.gitlab.com/omnibus/docker/#after-starting-a-container" rel="nofollow">http://doc.gitlab.com/omnibus/docker/#after-starting-a-container</a> was saying. </p>

<p>I would like to access via <a href="http://public_ip:18080" rel="nofollow">http://public_ip:18080</a>. How can I achieve that? </p>

<p>I already tried opening port 18080 in CentOS:</p>

<blockquote>
  <p>$ sudo firewall-cmd --zone=public --add-port=18080/tcp --permanent</p>
  
  <p>$ sudo firewall-cmd --reload </p>
</blockquote>

<p>but it's not working (and I don't really know what I'm doing here). </p>

<p>The container is running and the command</p>

<blockquote>
  <p>docker ps -a</p>
</blockquote>

<p>shows this:</p>

<blockquote>
  <p>88510679f781        gitlab/gitlab-ce:latest    "/assets/wrapper"        About an hour ago   Up About an hour                 0.0.0.0:12222->22/tcp, 0.0.0.0:18080->80/tcp, 0.0.0.0:1443->443/tcp         gitlab</p>
</blockquote>

<p>I can access the webpage from inside the server and from different machines inside the same cluster using the private ip of my server and port 18080. However, I cannot access with the preconfigured public ip of the server.</p>

<p>EDIT:</p>

<p>As pointed out in the replies, the issue was that the firewall was not letting us listen on every port. Changing the mapping to an available port made the trick</p>