Configuration to run minio docker container as service by gitlab-ci for testing purpose
Asked Answered
E

1

8

I have tried several times to start the Minio server as a service in GitLab CI tu run my tests that need S3 buckets, but all the time I get the error that "Cannot link to a non running container". This is how docker-compose.yaml for Minio Server looks like from the official site:

services:
 minio1:
  image: minio/minio:RELEASE.2019-03-27T22-35-21Z
  volumes:
   - data1:/data
  ports:
   - "9001:9000"
  environment:
   MINIO_ACCESS_KEY: ***
   MINIO_SECRET_KEY: ***
  command: server http://minio1/data 

Here it tried to start the Minio Server with the Docker in Docker in my gitlab-ci:

stages:
-test
image: my_image

u_tests:
  services:
    - name: minio/minio:RELEASE.2019-03-27T22-35-21Z
      alias: miniotest
    - name: docker:stable-dind
      command:
        - docker run -p 9000:9000 --name minio1 \
          -e "MINIO_ACCESS_KEY=key" \
          -e "MINIO_SECRET_KEY=key" \
          minio/minio server /data
  variables:
    MINIO_ACCESS_KEY: ***
    MINIO_SECRET_KEY: ***
  stage: test
  script:
  - make test

Here I tried to start the server with command (and also with entrypoint) like in docker-compose file, but didn't succeed.

 unit_tests:
   services:
    - name: minio/minio:RELEASE.2019-03-27T22-35-21Z
      alias: minio
      command: ["server /home/dataminio"]
    - minio/minio:latest
      entrypoint:["sh", "-c", "minio start"]

   variables:
     MINIO_ACCESS_KEY: ***
     MINIO_SECRET_KEY: ***

What would be a possible configuration in gitlab.ci to start the Minio Server docker as a service so that my main image can access it?

Evanesce answered 4/4, 2019 at 16:46 Comment(0)
T
7

Found this one: https://docs.rs/crate/s4/0.0.15/source/.gitlab-ci.yml

services:
- name: minio/minio
  command: ['server', '/minio']
  alias: minio

variables:
  S3_ENDPOINT: http://minio:9000
  # used by minio service
  MINIO_SECRET_KEY: TtnuieannGt2rGuie2t8Tt7urarg5nauedRndrur
  MINIO_ACCESS_KEY: ANTN35UAENTS5UIAEATD
  MINIO_DOMAIN: localhost

Worked fine for my case

Tuneberg answered 15/12, 2020 at 10:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.