Execute external bash script inside GitLab-ci Docker build
I would like to execute an external (on the local machine) bash script from gitlab-ci.yml which uses the docker:stable image. I would like to execute startup.sh located outside the gitlab docker image. Is this possible or are there better options?
image: docker:stable #Build script variables: CI_DEBUG_TRACE: "true" DOCKER_DRIVER: overlay before_script: - docker --version build: services: - docker:dind script: - docker build --no-cache -t <tag> . - docker login -u root -p <pass> <registry> - docker tag ... - docker push ... - echo "build completed" stage: build tags: - <tag> deploy_staging: stage: deploy script: - ./sh startup.sh
#!/bin/bash docker login -u root -p <pass> docker pull <image> docker-compose up -d
See also questions close to this topic
Unable to init from given binary data using docker container
Unable to init from given binary data.
I want to save an image with laravel using Vue.js but, As I wrote in the title, An error is returned 「Unable to init from given binary data.」 In laravel I write the code as follows
$image = $request->get('imgUrl1'); $name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))); $base=base64_decode($image); Image::make($base)->save(public_path('img/articles/').$name); imgUrl1: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfcA... <string is too large to edit>
Unable to init from given binary data.
"message": "Unable to init from given binary data.", "exception": "Intervention\\Image\\Exception\\NotReadableException", "file": "/var/www/laravel/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php", "line": 113,
please help me
CentOS7: How to start the slapd service in a docker container?
I want to run an OpenLDAP server in a docker container using CentOS7. I managed to have a container running with an openldap installed in it. My problem is that I am using a script entrypoint.sh to start the slapd service and add a user to my directory. I would like this two steps to be in the Dockerfile so that the password to perform ldapadd is not stored in the script.
So far I have only found examples on debian . https://github.com/kanboard/docker-openldap/blob/master/memberUid/Dockerfile this is what I would like to do but using CentOS 7. I tried start slapd service in my Dockerfile without success.
RUN systemctl slapd start RUN ldapadd -x -w password -D "cn=ldapadm,dc=mydomain" -f /etc/openldap/schema/base.ldif
I know systemctl won't work in my container, I was wondering what was the most suitable solution.. Is it to run another container that would start the slapd service ? Is there a better alternative ?
How run bottle application as docker-container?
I make bottle-framework-application, it works fine on localhost. I use virtualenv.
Then i build docker container. My Dockerfile:
FROM ubuntu COPY . . RUN /bin/bash -c "source venv/bin/activate" ENTRYPOINT /bin/bash -c "python3 index.py"
Biuld-process its OK:
(venv) kalinin@md ~/python/bottler $ docker build -t bottler . Sending build context to Docker daemon 26.07MB Step 1/4 : FROM ubuntu ---> 7698f282e524 Step 2/4 : COPY . . ---> 9e182c969051 Step 3/4 : RUN /bin/bash -c "source venv/bin/activate" ---> Running in 2022e2fa7600 Removing intermediate container 2022e2fa7600 ---> 16209d249539 Step 4/4 : ENTRYPOINT python3 index.py ---> Running in 84594de70d72 Removing intermediate container 84594de70d72 ---> d5057555ab1a Successfully built d5057555ab1a Successfully tagged bottler:latest
After build, i try run container:
docker run -i -t --rm -p 8000:8000 bottler
But get follow error message:
/bin/bash: python3: command not found
Please help my run application. After run i need see application in browser.
Gitlab CODEOWNERS to automatically add approvers
I love GitLab, but I am frustrated to assign approvers manually for each Merge Request. Gitlab friendly suggest to
Tip: add a CODEOWNERS to automatically add approvers based on file paths and file types.And so I did , I have created a file under :
.gitlab/docs/CODEOWNERS.txtHere is the contents of my file :
Multiple codeowners can be specified, separated by whitespace
CODEOWNERS @eduardo.baiao @n.belokopytov @viacheslav.iankovyi @yan.braslavsky
But unfortunately it does not auto assigns reviewers during Merge Requests. Did I do something wrong ? Am I missing something ?
How do I start a gitlab-ce container via docker-compose with admin credentials already set up?
I have a
docker-compose.ymlfile with a Gitlab CE container:
services: // other services.. gitlab: image: 'gitlab/gitlab-ce' restart: always ports: - '80:80' - '443:443' - '22:22' - "127.0.0.1:8081:80" volumes: - '/etc/gitlab' - '/var/log/gitlab' - '/var/opt/gitlab' networks: - backend
On startup, this requires you to open the browser, go to(in this case)
localhost:8081and manually input a password.
I'd like for this process to be automated(for local development and testing purposes).
Gitlab's own answers:
gitlab-rails console production user = User.where(id: 1).first user.password = 'somethingsomething' user.password_confirmation = 'somethingsomething' user.save! exit
Which works if I ssh into the Gitlab CE container after everything is set up(takes minutes).
Running this directly via
commanddoes not work - presumably because the
gitlab-rails consoleisn't ready to go yet the minute the container is up.
I've tried to manually create a
COPYto get the above script into the container and
CMDit. However, as predicted, this fails as
gitlab-rails consoleisn't ready yet on start-up. It takes a while.
Ideal scenario is that the container starts, installs Gitlab and does all the setup stuff; then sets the root admin password automatically.
Fulltext search over all git repositories (gitlab)
Is there a way to search over all git repositories with gitlab?
At the moment we are using the open source version of gitlab.
Since it is open source, there should be a way to enable it without switching to the commercial version....
Get latest tag in .gitlab-ci.yml for Docker build
I want to add a tag when building a Docker image, I'm doing this so far but I do not know how to get the latest tag on the repository being deployed.
docker build -t company/app .
My goal docker build -t company/app:$LATEST_TAG_IN_REPO? .
Gitlab CICD pipeline with `hashicorp/terraform:full` image errors with `terraform: command not found`
I have a Gitlab pipeline to deploy AWS infrastructure using Terraform. When I use the
hashicorp/terraform:lightimage everything works as expected. However, when I use the
hashicorp/terraform:full, it cannot find
Below is the
.gitlab-ci.ymlfile I have:
image: name: hashicorp/terraform:light entrypoint: - '/usr/bin/env' - 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' before_script: - rm -rf .terraform - export AWS_ACCESS_KEY - export AWS_SECRET_KEY - terraform init stages: - validate - plan - apply validate: stage: validate script: - terraform validate plan: stage: plan script: - terraform plan -out "planfile" dependencies: - validate artifacts: paths: - planfile apply: stage: apply script: - terraform apply -input=false "planfile" dependencies: - plan when: manual
hashicorp/terraform:fullI get a
command not founderror even though nothhing else changed.
How can I make this work with the
Gitlab Runners wont kill cancelled jobs
We have some jobs that take several hours to run, and you can sometimes detect it is going to fail early so it can be useful to cancel the job. But while the job disspears from the job list, it doesnt free up the runner and the task is left running on the machine hosting the runner. The only way to kill it seems to be to connect to the runner and kill the process it was running. How does the runner kills jobs? Gitlab-runner is running on a linux machine not inside a docker container.
- Container in dind access another container in the same Kubernetes pod
How to share volume between sibling containers without modifying the host
I have an image with ssh keys here:
WORKDIR /keys COPY ssh ssh
then I run this image as a container:
docker run -ti \ --rm -v '/var/run/docker.sock:/var/run/docker.sock' --name test gitleaks-test
and in the entrypoint I launch another container:
ls -a /keys/ssh/values docker run --rm --name=gitleaks \ -v "/keys/ssh/values:/root/.ssh" \ zricethezav/gitleaks \ --ssh-key='/keys/ssh/values/bucket' \ --repo "$line"
ls -acommand logs this:
. .. bucket bucket.pub
so the keys are in the running container, but I don't think the --volume command is doing what I think it is:
my guess is since these containers are running as siblings, that the -v command is going from the host to the inner container, not from the outer container, to the inner container, is that right?
Note that if I override entrypoint using:
docker run --rm --name=gitleaks \ -v "/keys/ssh/values:/root/.ssh" \ --entrypoint ls \ zricethezav/gitleaks -a /root/.ssh