Home > front end >  gitlab runner docker networks missing
gitlab runner docker networks missing

Time:02-26

I'm trying to set up a ci cd with gitlab and docker, but when gitlab runner executes the command docker network ls. The nginxproxymanager_default network is missing while on my vps if I run the same command, the nginxproxymanager network is present.

gitlab-ci.yml:

$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
3f277ce4da1a        bridge              bridge              local
e3c2cfc360d0        host                host                local
e0d83076a0f3        none                null                local

ssh with vps:

docker network ls
NETWORK ID     NAME                        DRIVER    SCOPE
fec1b6465ccd   bridge                      bridge    local
d2f1618cf9a9   host                        host      local
b879f034d44a   nginxproxymanager_default   bridge    local
54cfc9978bc1   none                        null      local

Can someone help me ? :/

CodePudding user response:

When you utilize docker-in-docker in GitLab using the docker:dind service, GitLab jobs do not share the same docker daemon as the host. The service is the daemon for your job. Each instance of the docker:dind service has its own set of networks, containers, etc. This is beneficial because it means that jobs won't accidentally interfere with one another. For example, if two jobs run concurrently and run docker run then docker ps -- each job will only see their own respective containers in the output of docker ps.

If you want GitLab jobs to use the host docker daemon then you have to mount the docker socket (/var/run/docker.sock) in the volumes configuration in your gitlab-runner. However, this is not recommended, partly for the reasons stated above.

CodePudding user response:

Are you sure gitlab-runner and vps is same 1 server?
Because When I look at the NETWORK ID, nothing is the same.

  • Related