|
|
# Setting up GitLab with Docker
|
|
# Setting up GitLab with Docker
|
|
|
|
|
|
|
|
### Useful commands:
|
|
### Useful commands:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo docker ps
|
|
sudo docker ps
|
|
|
sudo docker image ls
|
|
sudo docker image ls
|
|
|
```
|
|
```
|
|
|
|
|
|
|
Edit container:
|
|
Edit container:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo docker exec -it gitlab /bin/bash
|
|
sudo docker exec -it gitlab /bin/bash
|
|
|
```
|
|
```
|
|
|
|
|
|
|
### Starting point
|
|
### Starting point
|
|
|
* Pre-installed Ubuntu 16.04 Desktop in Virtual Box
|
|
* Pre-installed Ubuntu 16.04 Desktop in Virtual Box
|
|
|
|
|
|
|
|
### Set up the repository
|
|
### Set up the repository
|
|
|
1. Update the apt package index:
|
|
1. Update the apt package index:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo apt-get update
|
|
sudo apt-get update
|
|
|
```
|
|
```
|
|
|
|
|
|
|
2. Install packages to allow apt to use a repository over HTTPS:
|
|
2. Install packages to allow apt to use a repository over HTTPS:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo apt-get install \
|
|
sudo apt-get install \
|
|
|
apt-transport-https \
|
|
apt-transport-https \
|
| ... | @@ -25,11 +32,15 @@ sudo apt-get install \ |
... | @@ -25,11 +32,15 @@ sudo apt-get install \ |
|
|
curl \
|
|
curl \
|
|
|
software-properties-common
|
|
software-properties-common
|
|
|
```
|
|
```
|
|
|
|
|
|
|
3. Add Docker's official GPG key:
|
|
3. Add Docker's official GPG key:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
|
|
```
|
|
```
|
|
|
|
|
|
|
4. Set up stable repository:
|
|
4. Set up stable repository:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo add-apt-repository \
|
|
sudo add-apt-repository \
|
|
|
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
|
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
| ... | @@ -39,37 +50,49 @@ sudo add-apt-repository \ |
... | @@ -39,37 +50,49 @@ sudo add-apt-repository \ |
|
|
|
|
|
|
|
### Install Docker CE
|
|
### Install Docker CE
|
|
|
1. Update the apt package index:
|
|
1. Update the apt package index:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo apt-get update
|
|
sudo apt-get update
|
|
|
```
|
|
```
|
|
|
|
|
|
|
2. Install Docker ce latest version:
|
|
2. Install Docker ce latest version:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo apt-get install docker-ce
|
|
sudo apt-get install docker-ce
|
|
|
```
|
|
```
|
|
|
|
|
|
|
3. Verify that Docker CE is working by running hello-world image:
|
|
3. Verify that Docker CE is working by running hello-world image:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo docker run hello-world
|
|
sudo docker run hello-world
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Install Docker Compose on Linux
|
|
### Install Docker Compose on Linux
|
|
|
1. Download Docker Compose:
|
|
1. Download 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
|
|
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:
|
|
2. Apply excecutable permissions to the binary:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo chmod +x /usr/local/bin/docker-compose
|
|
sudo chmod +x /usr/local/bin/docker-compose
|
|
|
```
|
|
```
|
|
|
|
|
|
|
3. Test the installation:
|
|
3. Test the installation:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo docker-compose --version
|
|
sudo docker-compose --version
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Install GitLab using docker-compose
|
|
### Install GitLab using docker-compose
|
|
|
1. Create docker-compose.yml file:
|
|
1. Create docker-compose.yml file:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo nano docker-compose.yml
|
|
sudo nano docker-compose.yml
|
|
|
```
|
|
```
|
|
|
|
|
|
|
2. Insert to file (remember to edit extrenal_url!):100:
|
|
2. Insert to file (remember to edit extrenal_url!):100:
|
|
|
|
|
|
|
|
```
|
|
```
|
| ... | @@ -92,6 +115,7 @@ web: |
... | @@ -92,6 +115,7 @@ web: |
|
|
```
|
|
```
|
|
|
|
|
|
|
|
3. To start GitLab run the following command in same folder where docker-compose.yml is:
|
|
3. To start GitLab run the following command in same folder where docker-compose.yml is:
|
|
|
|
|
|
|
```
|
|
```
|
|
|
sudo docker-compose up -d
|
|
sudo docker-compose up -d
|
|
|
``` |
|
``` |