Gitlab Dockerfiles build not setting Entrypoint and CMD correctly - build working on Dockerhub
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
This build works fine on Dockerhub but fails to launch on Gitlab.
When building a container on gitlab which specifies the CMD ["/usr/local/bin/docker-entrypoint"] in the Dockerfile using Gitlab auto devops build process it deploys the container to kubernetes with the following docker command set.
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"/usr/local/bin/docker-entrypoint\"]"
],
"Healthcheck": {
"Test": [
"NONE"
]
},
"Image": "sha256:eb05a96ce828854c7c080201c35a2cfe094d87693216842ac6e63aea5eb8f136",
"Volumes": null,
"WorkingDir": "/var/www/html",
"Entrypoint": [
"docker-php-entrypoint"
],
You can see that the command seems to be wrapped incorrectly and that it would never run correctly within a container.
Steps to reproduce
Use the php-apache base container and set a line below it as follows.
CMD ["/usr/local/bin/docker-entrypoint"]
Example Project
https://gitlab.com/pansensic/scraper-ui-2.0 is the project we are seeing issues with. This project is unfortunately private but I will try and create a minimal example if I have time next week.
What is the current bug behavior?
The container gets deployed as usual to kubernetes but does not launch. When ssh'ing into the node and docker inspecting the container we see that it is being launched with an incorrect CMD prepended with /bin/sh even though this is not what was specified in the Dockerfile. Even more oddly the entire string CMD [\"/usr/local/bin/docker-entrypoint\"] is in the command rather than just the command itself.
What is the expected correct behavior?
Docker inspect should show
"Cmd": [
"/usr/local/bin/docker-entrypoint\"
],
Relevant logs and/or screenshots
Nothing relevant in the build log
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)