Building container image uses services
Use docker:dind
for containerized Docker daemon
The GitLab runner must be configured to run privileged container
Alternatives: Rootless and or daeamonless builds using…
Package binary in container image
Dockerfile
to repositorypackage
after test
Add job package
in stage package
package:
image: docker:20.10.21
stage: package
script:
- docker build --tag hello .
Package binary in container image
Add service to job package
package:
services:
- name: docker:20.10.21-dind
command: [ "dockerd", "--host", "tcp://0.0.0.0:2375" ]
#...
See new .gitlab-ci.yml
:
git checkout origin/160_gitlab_ci/230_docker -- '*'