Could you tell me if I do it in correct way:
Before I had had in .gitlab-ci.yml
same_task:
stage: deploy
image: python:3
script:
- python -V
Now I have:
pep8:
stage: deploy
image: gitlablogin/projectname
script:
- python -V
and after this change job failed:
Running with gitlab-runner 11.4.2 (cf91d5e1)
on docker-auto-scale 72989761
Using Docker executor with image gitlablogin/projectname ...
Pulling docker image gitlablogin/projectname ...
ERROR: Job failed: Error response from daemon: pull access denied for gitlablogin/projectname, repository does not exist or may require 'docker login' (executor_docker.go:168:0s)
Is my usage of docker in context of gitlab CI and gitlab registry is correct? I also want to keep my docker file on same repo and build new image when samething change in Dockerfile, what will be the best way to do it?
Context. In milestone 8.8, GitLab launched the MVC of the Container Registry. This feature integrated the Docker Distribution registry into GitLab so that any GitLab user could have a space to publish and share container images.
Control Container Registry from within GitLab GitLab offers a simple Container Registry management panel. Go to your project and click Packages > Container Registry in the project menu. This view will show you all Docker images in your project and will easily allow you to delete them.
Right now it is possible to use images from your gitlab registry without any special steps. Just build and push an image to your gitlab project container registry
docker build -t registry.gitlab.com/gitlabProject/projectName:build .
docker push registry.gitlab.com/gitlabProject/projectName:build
and then just specify this image in your pipeline settings:
image: registry.gitlab.com/gitlabProject/projectName:build
Gitlab is able to pull this image using it's credentials:
Preparing the "docker+machine" executor
00:46
Using Docker executor with image registry.gitlab.com/gitlabProject/projectName:build ...
Authenticating with credentials from job payload (GitLab Registry)
Pulling docker image registry.gitlab.com/gitlabProject/projectName:build ...
Using docker image sha256:e7e0f4f5fa8cff8a93b1f37ffd7dd0505946648246aa921dd457c06a1607304b for registry.gitlab.com/gitlabProject/projectName:build ...
More: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#using-a-private-container-registry
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With