bash - File not found in Docker Container using GitLab-CI -


using gitlab-ci, attempting echo secret variable file inside docker container. file exists , user has permissions write file yet no such file or directory error.

$ /usr/bin/docker exec -t $ci_project_name ls -la /opt/application/conf/kubeadminaccount.yml     -rw-rw-r-- 1 nodeuser nodeuser 420 aug 18 07:19 /opt/application/conf/kubeadminaccount.yml  $ /usr/bin/docker exec -t $ci_project_name whoami     nodeuser  $ /usr/bin/docker exec -t $ci_project_name echo $kube_admin_account > /opt/application/conf/kubeadminaccount.yml     bash: line 69: /opt/application/conf/kubeadminaccount.yml: no such file or directory 

your redirection operator working on host , not inside container. change below

$ /usr/bin/docker exec -t $ci_project_name echo $kube_admin_account > /opt/application/conf/kubeadminaccount.yml 

to

$ /usr/bin/docker exec -t $ci_project_name bash -c "echo $kube_admin_account > /opt/application/conf/kubeadminaccount.yml" 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -