By Haseeb Majid
An application which works with GitLab CI to run jobs in a pipeline 1.
Any system used to make sure the CI jobs are run 2.
Each job is run separately from each other.
Let’s take a look at a few of them in more detail.
notes:
notes:
notes:
It depends on the executor we use.
Let’s take a look at how we can do per executor 3
notes:
docker groupnotes:
notes:
docker+machine executor
services-example:
image: docker:24.0.7
services:
- docker:dind
- nginx
script:
- sleep 5
- wget -O - http://nginx:80
- docker ps -a
docker ps# Output
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Let’s look an example:
services:
nginx:
image: nginx
ports:
- 8080:80
docker-compose-example:
image: docker:24.0.7
services:
- docker:dind
before_script:
- docker-compose up --detach
script:
- sleep 5
- wget -O - http://docker:8080
- docker ps -a
after_script:
- docker-compose down
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
94e16c6ec4f9 nginx "/docker-entrypoint.…" 7 seconds ago Up 5 seconds 0.0.0.0:8080->80/tcp, :::8080->80/tcp ci-dind-docker-compose-nginx-1
# View all docker neworks
docker network ls
NETWORK ID NAME DRIVER SCOPE
a5d2becba851 bridge bridge local
8b593743d091 ci-dind-docker-compose_default bridge local
77382cfc2d50 host host local
9ad5bc56591c none null local
# Inspect the docker compose network
docker network inspect ci-dind-docker-compose_default
[
{
"Name": "ci-dind-docker-compose_default",
"Id": "773e4ec2e9c032cbbd6fa903512089147a946327d46ae7264de487e8da95be5b",
"Created": "2023-11-28T14:48:29.714351003Z",
"Scope": "local",
"Driver": "bridge",
"ConfigOnly": false,
"Containers": {
"c0f3c94f601f68296d204f982de792ad70b7fe8c1563d07e0fca23d8beb72206": {
"Name": "ci-dind-docker-compose-nginx-1",
"EndpointID": "459198d8260f3474fbf8d426abc5fd4a3871c5c2dcff7005975ec6589ac75734",
"MacAddress": "02:42:ac:13:00:02",
"IPv4Address": "172.19.0.2/16",
"IPv6Address": ""
}
},
}
]