Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
4495abcd
Commit
4495abcd
authored
Jul 25, 2018
by
Tobias Hernstig
Committed by
Achilleas Pipinellis
Jul 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update doc/ci/docker/using_docker_build.md
parent
6cb30f83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
doc/ci/docker/using_docker_build.md
doc/ci/docker/using_docker_build.md
+6
-4
No files found.
doc/ci/docker/using_docker_build.md
View file @
4495abcd
...
...
@@ -427,7 +427,7 @@ services:
variables
:
DOCKER_HOST
:
tcp://docker:2375
DOCKER_DRIVER
:
overlay2
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_
NAME
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_
SLUG
before_script
:
-
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
...
...
@@ -440,8 +440,10 @@ build:
```
Here,
`$CI_REGISTRY_IMAGE`
would be resolved to the address of the registry tied
to this project, and
`$CI_COMMIT_REF_NAME`
would be resolved to the branch or
tag name for this particular job. We also declare our own variable,
`$IMAGE_TAG`
,
to this project. Since
`$CI_COMMIT_REF_NAME`
resolves to the branch or tag name,
and your branch-name can contain forward slashes (e.g., feature/my-feature), it is
safer to use
`$CI_COMMIT_REF_SLUG`
as the image tag. This is due to that image tags
cannot contain forward slashes. We also declare our own variable,
`$IMAGE_TAG`
,
combining the two to save us some typing in the
`script`
section.
Here's a more elaborate example that splits up the tasks into 4 pipeline stages,
...
...
@@ -464,7 +466,7 @@ stages:
variables
:
DOCKER_HOST
:
tcp://docker:2375
DOCKER_DRIVER
:
overlay2
CONTAINER_TEST_IMAGE
:
registry.example.com/my-group/my-project/my-image:$CI_COMMIT_REF_
NAME
CONTAINER_TEST_IMAGE
:
registry.example.com/my-group/my-project/my-image:$CI_COMMIT_REF_
SLUG
CONTAINER_RELEASE_IMAGE
:
registry.example.com/my-group/my-project/my-image:latest
before_script
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment