Since I want to use docker build
and docker-compose
in gitlab CI, the image should be specified as image: docker:latest
. However, when I run some scripts including git command, it turns out that git and other build-essentials are not included in this image. Even though I use apt-get
, the command is still not found.
I think the docker image is based on Alpine and apparently uses a different package manager: apk .
So you can:
apk
instead of apt-get
. apt-get
. In both cases it would be better not to run apt-get
during the build process because it will slow it down and can possibly fail and make your whole build fail. Instead create your own Docker image based on one of the two images mentioned above and containing the extra tools you need (eg git) and use that own image in .gitlab-ci.yml .
FROM gitlab/dind:latest
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y git && \
rm -r /var/lib/apt/lists/*
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.