|
|
|
# Setting up GitLab with Docker
|
|
|
|
|
|
|
|
### Starting point
|
|
|
|
* Pre-installed Ubuntu 16.04 in Virtual Box
|
|
|
|
|
|
|
|
### Set up the repository
|
|
|
|
1. Update the apt package index:
|
|
|
|
```
|
|
|
|
sudo apt-get update
|
|
|
|
```
|
|
|
|
2. Install packages to allow apt to use a repository over HTTPS:
|
|
|
|
```
|
|
|
|
sudo apt-get install \
|
|
|
|
apt-transport-https \
|
|
|
|
ca-certificates \
|
|
|
|
curl \
|
|
|
|
software-properties-common
|
|
|
|
```
|
|
|
|
3. Add Docker's official GPG key:
|
|
|
|
```
|
|
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
|
|
|
```
|
|
|
|
4. Set up stable repository:
|
|
|
|
```
|
|
|
|
sudo add-apt-repository \
|
|
|
|
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
|
|
|
$(lsb_release -cs) \
|
|
|
|
stable"
|
|
|
|
```
|
|
|
|
|
|
|
|
### Install Docker CE
|
|
|
|
1. Update the apt package index:
|
|
|
|
```
|
|
|
|
sudo apt-get update
|
|
|
|
```
|
|
|
|
2. Install Docker ce latest version:
|
|
|
|
```
|
|
|
|
sudo apt-get install docker-ce
|
|
|
|
```
|
|
|
|
3. Verify that Docker CE is working by running hello-world image:
|
|
|
|
```
|
|
|
|
sudo docker run hello-world
|
|
|
|
```
|
|
|
|
|
|
|
|
### Install Docker Compose on Linux
|
|
|
|
1. Download latest version of Docker Compose:
|
|
|
|
```
|
|
|
|
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
|
|
|
```
|
|
|
|
2. Apply excecutable permissions to the binary:
|
|
|
|
```
|
|
|
|
sudo chmod +x /usr/local/bin/docker-compose
|
|
|
|
```
|
|
|
|
3. Test the installation:
|
|
|
|
```
|
|
|
|
sudo docker-compose --version
|
|
|
|
```
|
|
|
|
|
|
|
|
### Install GitLab using docker-compose
|
|
|
|
1. Create docker-compose.yml file:
|
|
|
|
```
|
|
|
|
sudo nano docker-compose.yml
|
|
|
|
```
|
|
|
|
2. Insert to file:
|
|
|
|
* hostname: leave empty
|
|
|
|
* external_url: http://your.ip
|
|
|
|
```
|
|
|
|
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:
|
|
|
|
- '80:80'
|
|
|
|
- '443:443'
|
|
|
|
- '22:22'
|
|
|
|
volumes:
|
|
|
|
- '/srv/gitlab/config:/etc/gitlab'
|
|
|
|
- '/srv/gitlab/logs:/var/log/gitlab'
|
|
|
|
- '/srv/gitlab/data:/var/opt/gitlab'
|
|
|
|
``` |