Run docker-compose build in .gitlab-ci.yml

前端 未结 9 1214
臣服心动
臣服心动 2020-12-12 14:06

I have a .gitlab-ci.yml file which contains following:

image: docker:latest

services:
  - docker:dind
         


        
9条回答
  •  独厮守ぢ
    2020-12-12 14:49

    EDIT I added another answer providing a minimal example for a .gitlab-ci.yml configuration supporting docker-compose.


    docker-compose can be installed as a Python package, which is not shipped with your image. The image you chose does not even provide an installation of Python:

    $ docker run --rm -it docker sh
    / # find / -iname "python"
    / # 
    

    Looking for Python gives an empty result. So you have to choose a different image, which fits to your needs and ideally has docker-compose installed or you maually create one.

    The docker image you chose uses Alpine Linux. You can use it as a base for your own image or try a different one first if you are not familiar with Alpine Linux.

    I had the same issue and created a Dockerfile in a public GitHub repository and connected it with my Docker Hub account and chose an automated build to build my image on each push to the GitHub repository. Then you can easily access your own images with the GitLab CI.

提交回复
热议问题