summaryrefslogtreecommitdiff
path: root/docker/README.md
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-06-29 17:56:34 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-07-06 16:42:52 +0200
commit954c1df256ac867635b31e82a032704e963a10ee (patch)
tree40bc344b6cec78f46d2823c25717a6810e2d9a7e /docker/README.md
parent2b5007245adfd31e31fd2917902494853ecbc931 (diff)
downloadgitlab-ce-954c1df256ac867635b31e82a032704e963a10ee.tar.gz
Update Docker documentation to use single container
Diffstat (limited to 'docker/README.md')
-rw-r--r--docker/README.md166
1 files changed, 85 insertions, 81 deletions
diff --git a/docker/README.md b/docker/README.md
index 9507aa6a63c..dd86cf6fa69 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -11,150 +11,154 @@ After starting a container you can go to [http://localhost:8080/](http://localho
It might take a while before the docker container is responding to queries.
-You can check the status with something like `sudo docker logs -f 7c10172d7705`.
+You can check the status with something like `sudo docker logs -f gitlab`.
You can login to the web interface with username `root` and password `password`.
Next time, you can just use docker start and stop to run the container.
-## How to build the docker images
+## Run the image
-This guide will also let you know how to build docker images yourself.
-Please run all the commands from the GitLab repo root directory.
-People using boot2docker should run all the commands without sudo.
+Run the image:
+```bash
+sudo docker run --detach \
+ --publish 80443:443 --publish 8080:80 --publish 2222:22 \
+ --name gitlab \
+ --restart always \
+ --volume /srv/gitlab/config:/etc/gitlab \
+ --volume /srv/gitlab/logs:/var/log/gitlab \
+ --volume /srv/gitlab/data:/var/opt/gitlab \
+ gitlab/gitlab-ce:latest
+```
-## Choosing between the single and the app and data images
+This will start GitLab CE container and expose ports needed to access SSH, HTTP and HTTPS.
+All GitLab data will be stored as subdirectories of `/srv/gitlab/`.
+The container will automatically `restart` after system reboot.
-Normally docker uses a single image for one applications.
-But GitLab stores repositories and uploads in the filesystem.
-This means that upgrades of a single image are hard.
-That is why we recommend using separate app and data images.
-We'll first describe how to use a single image.
-After that we'll describe how to use the app and data images.
+After this you can login to the web interface as explained above in 'After starting a container'.
-## Single image
+## Build and publish the image
-Get a published image from Dockerhub:
+This guide will also let you know how to build docker image yourself.
+Please run all the commands from the GitLab repo root directory.
+People using boot2docker should run all the commands without sudo.
```bash
-sudo docker pull sytse/gitlab-ce:7.10.1
+sudo docker build --tag gitlab/gitlab-ce:latest
```
-Run the image:
+## Where is the data stored?
-```bash
-sudo docker run --detach --publish 8080:80 --publish 2222:22 sytse/gitlab-ce:7.10.1
-```
+The GitLab container uses host mounted volumes to store persistent data:
+- `/srv/gitlab/data` mounted as `/var/opt/gitlab` in the container is used for storing *application data*
+- `/srv/gitlab/logs` mounted as `/var/log/gitlab` in the container is used for storing *logs*
+- `/srv/gitlab/config` mounted as `/etc/gitlab` in the container is used for storing *configuration*
-After this you can login to the web interface as explained above in 'After starting a container'.
+You can fine tune these directories to meet your requirements.
+
+### Configure GitLab
-Build the image:
+This container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`.
+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:
```bash
-sudo docker build --tag sytse/gitlab-ce:7.10.1 docker/single/
+sudo docker exec -it gitlab /bin/bash
```
-Publish the image to Dockerhub:
-
+You can also edit just `/etc/gitlab/gitlab.rb`:
```bash
-sudo docker push sytse/gitlab-ce
+sudo docker exec -it gitlab vi /etc/gitlab/gitlab.rb
```
-Diagnosing commands:
+**You should set the `external_url` to point to a valid URL.**
+
+**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),
+because Docker image doesn't have a SMTP server.**
+
+**Note** that GitLab will reconfigure itself **at each container start.** You will need to restart the container to reconfigure your GitLab:
```bash
-sudo docker run -i -t sytse/gitlab-ce:7.10.1
-sudo docker run -ti -e TERM=linux --name gitlab-ce-troubleshoot --publish 8080:80 --publish 2222:22 sytse/gitlab-ce:7.10.1 bash /usr/local/bin/wrapper
+sudo docker restart gitlab
```
-## App and data images
+For more options for configuring the container please check [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration).
-### Get published images from Dockerhub
+## Diagnose potential problems
+Read container logs:
```bash
-sudo docker pull sytse/gitlab-data
-sudo docker pull sytse/gitlab-app:7.10.1
+sudo docker logs gitlab
```
-### Run the images
-
+Enter running container:
```bash
-sudo docker run --name gitlab-data sytse/gitlab-data /bin/true
-sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data sytse/gitlab-app:7.10.1
+sudo docker exec -it gitlab /bin/bash
```
-After this you can login to the web interface as explained above in 'After starting a container'.
+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.
-### Build images
-
-Build your own based on the Omnibus packages with the following commands.
+### Upgrade GitLab to newer version
+To upgrade GitLab to new version you have to do:
+1. pull new image,
```bash
-sudo docker build --tag gitlab-data docker/data/
-sudo docker build --tag gitlab-app:7.10.1 docker/app/
+sudo docker stop gitlab
```
-After this run the images:
-
+1. stop running container,
```bash
-sudo docker run --name gitlab-data gitlab-data /bin/true
-sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data gitlab-app:7.10.1
+sudo docker rm gitlab
```
-We assume using a data volume container, this will simplify migrations and backups.
-This empty container will exist to persist as volumes the 3 directories used by GitLab, so remember not to delete it.
-
-The directories on data container are:
-
-- `/var/opt/gitlab` for application data
-- `/var/log/gitlab` for logs
-- `/etc/gitlab` for configuration
-
-### Configure GitLab
-
-This container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`.
-
-To access GitLab configuration, you can start an interactive command line in a new container using the shared data volume container, you will be able to browse the 3 directories and use your favorite text editor:
+1. remove existing container,
+```bash
+sudo docker pull gitlab/gitlab-ce:latest
+```
+1. create the container once again with previously specified options.
```bash
-sudo docker run -ti -e TERM=linux --rm --volumes-from gitlab-data ubuntu
-vi /etc/gitlab/gitlab.rb
+sudo docker run --detach \
+ --publish 80443:443 --publish 8080:80 --publish 2222:22 \
+ --name gitlab \
+ --restart always \
+ --volume /srv/gitlab/config:/etc/gitlab \
+ --volume /srv/gitlab/logs:/var/log/gitlab \
+ --volume /srv/gitlab/data:/var/opt/gitlab \
+ gitlab/gitlab-ce:latest
```
-**Note** that GitLab will reconfigure itself **at each container start.** You will need to restart the container to reconfigure your GitLab.
+On the first run GitLab will reconfigure and update itself.
-You can find all available options in [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration).
+### Run GitLab CE on public IP address
-### Upgrade GitLab with app and data images
+You can make Docker to use your IP address and forward all traffic to the GitLab CE container.
+You can do that by modifying the `--publish` ((Binding container ports to the host)[https://docs.docker.com/articles/networking/#binding-ports]):
-To upgrade GitLab to new versions, stop running container, create new docker image and container from that image.
+> --publish=[] : Publish a container᾿s port or a range of ports to the host format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
-It Assumes that you're upgrading from 7.8.1 to 7.10.1 and you're in the updated GitLab repo root directory:
+To expose GitLab CE on IP 1.1.1.1:
```bash
-sudo docker stop gitlab-app
-sudo docker rm gitlab-app
-sudo docker build --tag gitlab-app:7.10.1 docker/app/
-sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data gitlab-app:7.10.1
+sudo docker run --detach \
+ --publish 1.1.1.1:443:443 --publish 1.1.1.1:80:80 --publish 1.1.1.1:22:22 \
+ --name gitlab \
+ --restart always \
+ --volume /srv/gitlab/config:/etc/gitlab \
+ --volume /srv/gitlab/logs:/var/log/gitlab \
+ --volume /srv/gitlab/data:/var/opt/gitlab \
+ gitlab/gitlab-ce:latest
```
-On the first run GitLab will reconfigure and update itself. If everything runs OK don't forget to cleanup the app image:
-
-```bash
-sudo docker rmi gitlab-app:7.8.1
-```
+You can then access GitLab instance at http://1.1.1.1/ and https://1.1.1.1/.
### Publish images to Dockerhub
- Ensure the containers are running
- Login to Dockerhub with `sudo docker login`
-- Run the following (replace '7.10.1' with the version you're using and 'Sytse Sijbrandij' with your name):
```bash
-sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab-app sytse/gitlab-app:7.10.1
-sudo docker push sytse/gitlab-app:7.10.1
-sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab-data sytse/gitlab-data
-sudo docker push sytse/gitlab-data
+sudo docker login
+sudo docker push gitlab/gitlab-ce:latest
```
## Troubleshooting