docker run my-docker-image /script/to/run/tests Use the Kubernetes executor with Docker-in-Docker DOCKER_TLS_CERTDIR : " " services : - docker:20.10.16-dind before_script : - docker info build : stage : build script : - docker build -t my-docker-image. # The 'docker' hostname is the alias of the service container as described at # If you're using GitLab Runner 12.7 or earlier with the Kubernetes executor and Kubernetes 1.6 or earlier, # the variable must be set to tcp://localhost:2375 because of how the # Kubernetes executor connects services to the job container # DOCKER_HOST: tcp://localhost:2375 # DOCKER_HOST : tcp://docker:2375 # This instructs Docker not to start over TLS. The daemon is available with # a network connection instead of the default /var/run/docker.sock socket. Image : docker:20.10.16 variables : # When using dind service, you must instruct docker to talk with the # daemon started inside of the service. Sometimes there are legitimate reasons to disable TLS.įor example, you have no control over the GitLab Runner configurationĪssuming that the runner’s config.toml is similar to: docker run my-docker-image /script/to/run/tests Docker-in-Docker with TLS disabled in the Docker executor Docker # creates them automatically on boot, and creates # `/certs/client` to share between the service and job # container, thanks to volume mount from config.toml DOCKER_TLS_CERTDIR : " /certs" services : - docker:20.10.16-dind before_script : - docker info build : stage : build script : - docker build -t my-docker-image. # Specify to Docker where to create the certificates. Docker 19.03 does this automatically # by setting the DOCKER_HOST in # The 'docker' hostname is the alias of the service container as described at #. The daemon is available # with a network connection instead of the default # /var/run/docker.sock socket. Image : docker:20.10.16 variables : # When you use the dind service, you must instruct Docker to talk with # the daemon started inside of the service. Docker-in-Docker with TLS enabled in the Docker executor You can use the Docker executor to run jobs in a Docker container. Use the Docker executor with Docker-in-Docker This can cause incompatibility problems when new versions are released. If you use a tag like docker:stable, you have no control over which version is used. You should always pin a specific version of the image, like docker:20.10.16. You should use Docker-in-Docker with TLS enabled, The job script in context of the image in privileged mode. The Docker image includes all of the docker tools and can run
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |