запускаю такой yml
image: docker:latest
services:
- name: docker:dind
stages:
- build
- test
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
build:
stage: build
tags:
- docker_builder
script:
- docker build --pull -t $IMAGE_TAG .
- docker push $IMAGE_TAG
test:
stage: test
tags:
- docker_builder
script:
- docker pull $IMAGE_TAG
- docker run -d $IMAGE_TAG /bin/bash "uname -a"
что собрать такой контейнер
FROM centos:7
ARG SSH_PRIVATE_KEY
#RUN mkdir /root/.ssh/
#RUN echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa
#RUN echo /root/.ssh/id_rsa
RUN yum -y update && yum -y install epel-release \
&& yum -y install ansible python-pip openssh-clients && yum install openssh-clients -y
RUN yum -y update && yum -y install
https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm && yum -y install postgresql11
RUN pip install ansible-lint
RUN sed -i 's/#host_key_checking = False/host_key_checking = False/g' /etc/ansible/ansible.cfg
# Default command
CMD ["/bin/bash"]