install gitlab on Windows with Docker

Yes, you can run gitlab-ce on windows using Docker. First, make sure docker is installed on Windows, otherwise install it.

A detailed documentation for how to run gitlab using Docker is found under GitLab Docker images including how to access the web interface.


You can check gitlab documantation from Expose GitLab on different ports section.

Before starting the installation create 3 folder which names "config","data","logs" in a "gitlab" folder. And run your gitlab-ce image with docker run command.Gitlab should be running firstly.

Note that I will use 8082 port for gitlab server.You can change it with any port number.

1-open cmd and show your IP address.You need to look for the IPv4 Address in your network adapter :

ipconfig

enter image description here

2-Run your docker-ce image with this command :

docker run --detach --hostname YOUR-IP-ADRESS --publish 8082:8082 --publish 2282:22 --name gitlab --restart always --volume D:\DevOps\Gitlab/config:/etc/gitlab --volume D:\DevOps\Gitlab/logs:/var/log/gitlab --volume D:\DevOps\Gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest

enter image description here 3-In docker terminal(in docker gui application press to "cli" buton) go here :

cd etc/gitlab

nano gitlab.rb

4-Go to end of file at gitlab.rb and write these lines :

external_url "http://your-ip-address:8082"

gitlab_rails['gitlab_shell_ssh_port'] = 2282

5-After save and close to gitlab.rb file enter this code for reconfiguration:

gitlab-ctl reconfigure

6-Remove your docker container and run with this command again:

docker run --detach --hostname YOUR-IP-ADRESS --publish 8082:8082 --publish 2282:22 --name gitlab --restart always --volume D:\DevOps\Gitlab/config:/etc/gitlab --volume D:\DevOps\Gitlab/logs:/var/log/gitlab --volume D:\DevOps\Gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest


  1. You need to install Docker for Windows.

  2. Share drive for Docker (in Docker's settings > shared drives). For example, drive E:

    settings

  1. Then, you need to create 3 directories on drive E: (e:\gitlab\config, e:\gitlab\logs, e:\gitlab\data)

  2. From the Command Prompt, run:

    docker run --detach --hostname gitlab.yourdomain.ru 
    --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab 
    --restart always --volume e:\gitlab\config:/etc/gitlab 
    --volume e:\gitlab\logs:/var/log/gitlab 
    --volume e:\gitlab\data:/var/opt/gitlab gitlab/gitlab-ce:latest
    

That's it! You have now successfully run GitLab image.