First use the following file gitlab_run.sh to generate the Letsencrypt certificate.
Source:
Https://github.com/flasheryu/docker-letsencrypt-nginx-proxy-companion-examples
#!/bin/bash# This example would run a basic nginx server provisionned with an index.htmlfile# Make sure to replace"site.example.com"With a public accessible domain poiting to the server you'll run this on.# this nginx container would get a Configur Ation generated by the Docker-gen instance and act as a reverse-ProxyEcho "starting Nginx instance ..."Docker Run-d-p the: the-P443:443 --name Nginx-v/etc/nginx/CONF.D-v/etc/nginx/VHOST.D-v/usr/share/nginx/HTML-V $ (pwd)/.. /.. /volumes/proxy/certs:/etc/nginx/Certs:ro Nginx# this Nginx-gen container using the Docker-gen image would generate a'default.conf' fileFrom the'Nginx.tmpl'Locatedinchvolumes/proxy/templates.Echo "starting Docker-gen instance ..."Docker Run-D--name nginx-Gen--volumes-From Nginx-V $ (pwd)/.. /.. /volumes/proxy/templates/nginx.tmpl:/etc/docker-gen/templates/Nginx.tmpl:ro-v/var/run/docker.sock:/tmp/Docker.sock:ro Jwilder/docker-Gen-notify-sighup nginx-watch-only-exposed-wait5s:30s/etc/docker-gen/templates/nginx.tmpl/etc/nginx/conf.d/default.confEcho "starting Letsencrypt-nginx-proxy-companion ..."Docker Run-D-E"Nginx_docker_gen_container=nginx-gen" --volumes-From Nginx-V $ (pwd)/.. /.. /volumes/proxy/certs:/etc/nginx/CERTS:RW-v/var/run/docker.sock:/var/run/Docker.sock:ro JRCs/letsencrypt-nginx-proxy-companion# This a example service that'll get picked up and served by the reverse proxy.# Make sure your change all The default valuesinchThisfileandinchvolumes/examples/simple-siteEcho "starting Simple-site Nginx example ..."Docker Run-D--name simple-site-E"virtual_host=dockeryu.com" -E"letsencrypt_host=dockeryu.com" -E"[email protected]" -V $ (pwd)/.. /.. /volumes/examples/simple-site/conf.d/:/etc/nginx/CONF.D Nginx
Then after the/volumes/proxy/certs has been generated certs, use the following command to build a omnibus version Gitlab with Letsencrypt free SSL version with one click.
Docker Run--detach--hostnameDockeryu.com--Envgitlab_omnibus_config="registry_external_url ' https://dockeryu.com:4040 '; registry_nginx[' ssl_certificate ']= '/etc/letsencrypt/live/ Dockeryu.com/dockeryu.com.crt '; registry_nginx[' Ssl_certificate_key ']= '/etc/letsencrypt/live/dockeryu.com/ Dockeryu.com.key '; External_url ' https://dockeryu.com/'; nginx[' Redirect_http_to_https ']=true;nginx[' Ssl_ Certificate ']= '/ETC/LETSENCRYPT/LIVE/DOCKERYU.COM/DOCKERYU.COM.CRT '; nginx[' Ssl_certificate_key ']= '/etc/ Letsencrypt/live/dockeryu.com/dockeryu.com.key ';"--publish443:443--publish the: the--publish222: A--publish4040:4040--name Gitlab--restart always--volume/srv/gitlab/config:/etc/gitlab--volume/srv/gitlab/logs:/var/log/gitlab-- Volume/srv/gitlab/data:/var/opt/gitlab--volume/volumes/proxy/certs:/etc/letsencrypt/live/dockeryu.com gitlab/ Gitlab-ce
After two minutes, the Gitlab can be started successfully.
Gitlab more configuration using the method reference:
http://docs.gitlab.com/omnibus/docker/
Note that using Letsencrypt may be overrun (limit rates,20 times a week), see:
https://letsencrypt.org/docs/rate-limits/
Docker version omnibus Gitlab plus lets encrypt free SSL one-click Setup