Service container with huge number of exposed ports cause "argument list too long" error
Summary
When a CI job defines a services section with a container that has a huge amount of exposed ports, e.g. EXPOSE 1000-10000
, then the runner will fail with standard_init_linux.go:190: exec user process caused "argument list too long"
.
Steps to reproduce
A minimal example repository: https://gitlab.com/klingtnet/gitlab-ci-argument-list-too-long-error Example job: https://gitlab.com/klingtnet/gitlab-ci-argument-list-too-long-error/-/jobs/302521898
.gitlab-ci.yml
test_job:
image: alpine
services:
- name: klingtdotnet/gitlab-ci-argument-list-too-long-error
script:
- echo 'Hello, World!'
Possible fixes
I haven't seen the actual implementation but I assume that the runner will pass -p src-port:dst-port
flags for each port defined in the service containers Dockerfile
. A fix would be to not expose port-ranges defined in the Dockerfile, instead warn when they were found and let the user explicitly expose the ports they need.