Skip to content
Snippets Groups Projects
Commit 35ce04ef authored by Mark Pundsack's avatar Mark Pundsack
Browse files

Move registry CI example to CI docs

parent 6f834eca
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -73,7 +73,8 @@ For more information please checkout [On Docker security: `docker` group conside
 
## 2. Use docker-in-docker executor
 
The second approach is to use the special Docker image with all tools installed
The second approach is to use the special docker-in-docker (dind)
[Docker image](https://hub.docker.com/_/docker/) with all tools installed
(`docker` and `docker-compose`) and run the build script in context of that
image in privileged mode.
 
Loading
Loading
@@ -222,10 +223,18 @@ e.g. `docker run --rm -t -i -v $(pwd)/src:/home/app/src test-image:latest run_ap
 
## Using the GitLab Container Registry
 
Once you've built a Docker image, you can push it up to the built-in [GitLab Container Registry](../../container_registry/README.md).
> **Note:**
This feature requires GitLab 8.8 and GitLab Runner 1.2.
 
```
Once you've built a Docker image, you can push it up to the built-in [GitLab Container Registry](../../container_registry/README.md). For example, if you're using
docker-in-docker on your runners, this is how your `.gitlab-ci.yml` could look:
```yaml
build:
image: docker:git
services:
- docker:dind
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.example.com
Loading
Loading
@@ -233,7 +242,12 @@ Once you've built a Docker image, you can push it up to the built-in [GitLab Con
- docker push registry.example.com/group/project:latest
```
 
Here's a more elaborate example that splits up the tasks into 4 stages,
You have to use the credentials of the special `gitlab-ci-token` user with its
password stored in `$CI_BUILD_TOKEN` in order to push to the Registry connected
to your project. This allows you to automate building and deployment of your
Docker images.
Here's a more elaborate example that splits up the tasks into 4 pipeline stages,
including two tests that run in parallel. The build is stored in the container
registry and used by subsequent stages, downloading the image
when needed. Changes to `master` also get tagged as `latest` and deployed using
Loading
Loading
Loading
Loading
@@ -79,27 +79,8 @@ delete them.
This feature requires GitLab 8.8 and GitLab Runner 1.2.
 
Make sure that your GitLab Runner is configured to allow building docker images.
You have to check the [Using Docker Build documentation](../../ci/docker/using_docker_build.md).
You can use [docker:dind](https://hub.docker.com/_/docker/) to build your images,
and this is how your `.gitlab-ci.yml` should look:
```
build_image:
image: docker:git
services:
- docker:dind
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.example.com
- docker build -t registry.example.com/group/project:latest .
- docker push registry.example.com/group/project:latest
```
You have to use the credentials of the special `gitlab-ci-token` user with its
password stored in `$CI_BUILD_TOKEN` in order to push to the Registry connected
to your project. This allows you to automate building and deployment of your
Docker images.
You have to check the [Using Docker Build documentation](../ci/docker/using_docker_build.md).
Then see the CI documentation on [Using the GitLab Container Registry](../ci/docker/using_docker_build.md#using-the-gitlab-container-registry).
 
## Limitations
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment