Can not pass command line arguments to GitLab CI services
Some Docker images are unable to start properly within GitLab CI as a service because they require specific command line arguments to be passed them while spinning them up, such as Minio (https://docs.minio.io/), which is an open source AWS S3 compliant service.
It's official documentation (https://github.com/minio/minio#minio-quickstart-guide----), indicates Minio requires the following to start successfully:
docker run -p 9000:9000 minio/minio server /export
Because there is no way to pass these command line arguments (server
and /export
) through .gitlab-ci.yml
so the service does not start properly:
- https://gitlab.com/TRPmwiesen/minio-test/commit/8d4ade32072b4ada02c9d00d2ba7217a93f6ba0f
- https://gitlab.com/TRPmwiesen/minio-test/builds/17992910
The only way to get around this limitation, that I can see is to build another Docker image that essentially acts as a wrapper to default these parameters to work correctly.
I created a new project to build a custom Minio Docker image and publish to GitLab Container Registry:
The only real change that I made between this version and the official Minio version is the Docker command, which in my version will specifiy the server
and /export
within the Docker CMD to ensure it runs this by default:
- https://gitlab.com/TRPmwiesen/minio-gitlab-ci-service/blob/master/Dockerfile#L30
- https://github.com/minio/minio/blob/master/Dockerfile#L30
After getting that project to build the docker image, I updated the my test repo to try to use the service andyou can see that the my modified service runs successfully since it receives a response from the curl request to port 9000 indicating that we need to authenticate first, but otherwise it is working properly.
https://gitlab.com/TRPmwiesen/minio-test/builds/18453574
There seems to be a need for a more advanced way of passing specific parameters / options via .gitlab-ci.yml
to GitLab services to support this since while a lot of Docker images mainly support being configured via environment variables, there are some projects such as Minio which are bundled with other features and appear to be configured via command line arguments.