尝试使用 CI 运行器为 gitlab 发布 docker 容器。跑步者正在触发,但每次我得到
Using Docker executor with image phusion/baseimage ...
ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
gitlab.ci.yml 非常简单
stages:
- deploy
deploy_staging:
stage: deploy
image: phusion/baseimage
script:
- docker info
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *ntStrictHostKeyChecking nonn" > ~/.ssh/config'
- ssh-add <(echo "$STAGING_PRIVATE_KEY")
- apt-get install rsync
- ssh -p22 gituser@STAGING-DK02 "mkdir -p /html/themes/_tmp"
任何帮助将不胜感激!
当我在没有提升权限的情况下运行任何 docker 命令时,我收到了该消息。
尝试在前面sudo
运行命令。
试试这个。
become_user: root
一些提示:
要在 shell 为 nologin 时以 none 用户身份执行某些操作:
- name: Run a command as nobody
command: somecommand
become: true
become_method: su
become_user: nobody
become_flags: '-s /bin/sh'