|
1 | 1 | # GitLab Docker images
|
2 | 2 |
|
3 |
| -The GitLab docker image is [available on Docker Hub](https://registry.hub.docker.com/u/gitlab/gitlab-ce/). |
4 |
| - |
5 |
| -## After starting a container |
6 |
| - |
7 |
| -After starting a container you can go to [http://localhost:8080/](http://localhost:8080/) or [http://192.168.59.103:8080/](http://192.168.59.103:8080/) if you use boot2docker. |
8 |
| - |
9 |
| -It might take a while before the docker container is responding to queries. |
10 |
| - |
11 |
| -You can check the status with something like `sudo docker logs -f gitlab`. |
12 |
| - |
13 |
| -You can login to the web interface with username `root` and password `5iveL!fe`. |
14 |
| - |
15 |
| -Next time, you can just use docker start and stop to run the container. |
16 |
| - |
17 |
| -## Run the image |
18 |
| - |
19 |
| -Run the image: |
20 |
| -```bash |
21 |
| -sudo docker run --detach \ |
22 |
| - --publish 8443:443 --publish 8080:80 --publish 2222:22 \ |
23 |
| - --name gitlab \ |
24 |
| - --restart always \ |
25 |
| - --volume /srv/gitlab/config:/etc/gitlab \ |
26 |
| - --volume /srv/gitlab/logs:/var/log/gitlab \ |
27 |
| - --volume /srv/gitlab/data:/var/opt/gitlab \ |
28 |
| - gitlab/gitlab-ce:latest |
29 |
| -``` |
30 |
| - |
31 |
| -This will download and start GitLab CE container and publish ports needed to access SSH, HTTP and HTTPS. |
32 |
| -All GitLab data will be stored as subdirectories of `/srv/gitlab/`. |
33 |
| -The container will automatically `restart` after system reboot. |
34 |
| - |
35 |
| -After this you can login to the web interface as explained above in 'After starting a container'. |
36 |
| - |
37 |
| -## Where is the data stored? |
38 |
| - |
39 |
| -The GitLab container uses host mounted volumes to store persistent data: |
40 |
| -- `/srv/gitlab/data` mounted as `/var/opt/gitlab` in the container is used for storing *application data* |
41 |
| -- `/srv/gitlab/logs` mounted as `/var/log/gitlab` in the container is used for storing *logs* |
42 |
| -- `/srv/gitlab/config` mounted as `/etc/gitlab` in the container is used for storing *configuration* |
43 |
| - |
44 |
| -You can fine tune these directories to meet your requirements. |
45 |
| - |
46 |
| -### Configure GitLab |
47 |
| - |
48 |
| -This container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`. |
49 |
| - |
50 |
| -To access GitLab configuration, you can start an bash in a new the context of running container, you will be able to browse all directories and use your favorite text editor: |
51 |
| -```bash |
52 |
| -sudo docker exec -it gitlab /bin/bash |
53 |
| -``` |
54 |
| - |
55 |
| -You can also edit just `/etc/gitlab/gitlab.rb`: |
56 |
| -```bash |
57 |
| -sudo docker exec -it gitlab vi /etc/gitlab/gitlab.rb |
58 |
| -``` |
59 |
| - |
60 |
| -**You should set the `external_url` to point to a valid URL.** |
61 |
| - |
62 |
| -**You may also be interesting in [Enabling HTTPS](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#enable-https).** |
63 |
| - |
64 |
| -**To receive e-mails from GitLab you have to configure the [SMTP settings](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md), |
65 |
| -because Docker image doesn't have a SMTP server.** |
66 |
| - |
67 |
| -**Note** that GitLab will reconfigure itself **at each container start.** You will need to restart the container to reconfigure your GitLab: |
68 |
| - |
69 |
| -```bash |
70 |
| -sudo docker restart gitlab |
71 |
| -``` |
72 |
| - |
73 |
| -For more options for configuring the container please check [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration). |
74 |
| - |
75 |
| -## Diagnose potential problems |
76 |
| - |
77 |
| -Read container logs: |
78 |
| -```bash |
79 |
| -sudo docker logs gitlab |
80 |
| -``` |
81 |
| - |
82 |
| -Enter running container: |
83 |
| -```bash |
84 |
| -sudo docker exec -it gitlab /bin/bash |
85 |
| -``` |
86 |
| - |
87 |
| -From within container you can administrer GitLab container as you would normally administer Omnibus installation: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md. |
88 |
| - |
89 |
| -### Upgrade GitLab to newer version |
90 |
| - |
91 |
| -To upgrade GitLab to new version you have to do: |
92 |
| -1. pull new image, |
93 |
| -```bash |
94 |
| -sudo docker stop gitlab |
95 |
| -``` |
96 |
| - |
97 |
| -1. stop running container, |
98 |
| -```bash |
99 |
| -sudo docker rm gitlab |
100 |
| -``` |
101 |
| - |
102 |
| -1. remove existing container, |
103 |
| -```bash |
104 |
| -sudo docker pull gitlab/gitlab-ce:latest |
105 |
| -``` |
106 |
| - |
107 |
| -1. create the container once again with previously specified options. |
108 |
| -```bash |
109 |
| -sudo docker run --detach \ |
110 |
| - --publish 8443:443 --publish 8080:80 --publish 2222:22 \ |
111 |
| - --name gitlab \ |
112 |
| - --restart always \ |
113 |
| - --volume /srv/gitlab/config:/etc/gitlab \ |
114 |
| - --volume /srv/gitlab/logs:/var/log/gitlab \ |
115 |
| - --volume /srv/gitlab/data:/var/opt/gitlab \ |
116 |
| - gitlab/gitlab-ce:latest |
117 |
| -``` |
118 |
| - |
119 |
| -On the first run GitLab will reconfigure and update itself. |
120 |
| - |
121 |
| -### Run GitLab CE on public IP address |
122 |
| - |
123 |
| -You can make Docker to use your IP address and forward all traffic to the GitLab CE container. |
124 |
| -You can do that by modifying the `--publish` ([Binding container ports to the host](https://docs.docker.com/articles/networking/#binding-ports)): |
125 |
| - |
126 |
| -> --publish=[] : Publish a container᾿s port or a range of ports to the host format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort |
127 |
| -
|
128 |
| -To expose GitLab CE on IP 1.1.1.1: |
129 |
| - |
130 |
| -```bash |
131 |
| -sudo docker run --detach \ |
132 |
| - --publish 1.1.1.1:443:443 --publish 1.1.1.1:80:80 --publish 1.1.1.1:22:22 \ |
133 |
| - --name gitlab \ |
134 |
| - --restart always \ |
135 |
| - --volume /srv/gitlab/config:/etc/gitlab \ |
136 |
| - --volume /srv/gitlab/logs:/var/log/gitlab \ |
137 |
| - --volume /srv/gitlab/data:/var/opt/gitlab \ |
138 |
| - gitlab/gitlab-ce:latest |
139 |
| -``` |
140 |
| - |
141 |
| -You can then access GitLab instance at http://1.1.1.1/ and https://1.1.1.1/. |
142 |
| - |
143 |
| -### Build the image |
144 |
| - |
145 |
| -This guide will also let you know how to build docker image yourself. |
146 |
| -Please run the command from the GitLab repo root directory. |
147 |
| -People using boot2docker should run all the commands without sudo. |
148 |
| - |
149 |
| -```bash |
150 |
| -sudo docker build --tag gitlab/gitlab-ce:latest docker/ |
151 |
| -``` |
152 |
| - |
153 |
| -### Publish the image to Dockerhub |
154 |
| - |
155 |
| -- Ensure the containers are running |
156 |
| -- Login to Dockerhub with `sudo docker login` |
157 |
| - |
158 |
| -```bash |
159 |
| -sudo docker login |
160 |
| -sudo docker push gitlab/gitlab-ce:latest |
161 |
| -``` |
162 |
| - |
163 |
| -## Troubleshooting |
164 |
| - |
165 |
| -Please see the [troubleshooting](troubleshooting.md) file in this directory. |
166 |
| - |
167 |
| -Note: We use `fig.yml` to have compatibility with fig and because docker-compose also supports it. |
168 |
| - |
169 |
| -Our docker image runs chef at every start to generate GitLab configuration. |
| 3 | +* The official GitLab Community Edition Docker image is [available on Docker Hub](https://registry.hub.docker.com/u/gitlab/gitlab-ce/). |
| 4 | +* The official GitLab Enterprise Edition Docker image is [available on Docker Hub](https://registry.hub.docker.com/u/gitlab/gitlab-ce/). |
| 5 | +* The complete usage guide can be found in [Using GitLab Docker images](http://doc.gitlab.com/omnibus/docker/) |
| 6 | +* The Dockerfile used for building public images is in [Omnibus Repository](https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master/docker) |
| 7 | +* Check the guide for [creating Omnibus-based Docker Image](http://doc.gitlab.com/omnibus/build/README.html#Build-Docker-image) |
0 commit comments