docker-compose:在詹金斯上找不到命令 [英] docker-compose: command not found on jenkins

查看:277
本文介绍了docker-compose:在詹金斯上找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个docker compose文件

I have a docker compose file

version: "3"
services:
  mysql:
    image: mysql:latest
    container_name: locations-service-mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USERNAME: root
      MYSQL_DATABASE: 'locations_schema'
    restart: always
    volumes:
      - mysql_data:/var/lib/mysql:rw

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    ports:
      - 8181:80
    environment:
      MYSQL_USERNAME: root
      MYSQL_ROOT_PASSWORD: root
      PMA_HOST: mysql
    depends_on:
      - mysql
    links:
      - mysql:mysql


  dropwizard:
    build:
      context : ../locations-service/
    ports:
          - 8080:8080
          - 8081:8081
    depends_on:
          - mysql
    links:
      - mysql:mysql
    restart: always
    container_name: locations-service

volumes:
  mysql_data:

并且我已经通过调用另一个外壳文件"environment.sh"将jenkins作业配置为执行该文件,但是它尝试执行以下错误:

And i've configure a jenkins job to execute this file by calling another shell file "environment.sh", but it attempts to execute the following error appears:

23:51:57 ./environment.sh: line 3: docker-compose: command not found
23:51:57 ./environment.sh: line 4: docker-compose: command not found
23:51:57 ./environment.sh: line 6: docker-compose: command not found
23:51:57  FAILED
23:51:57 
23:51:57 FAILURE: Build failed with an exception.
23:51:57 
23:51:57 * What went wrong:
23:51:57 Execution failed for task ':startDockerEnvironment'.
23:51:57 > Process 'command './environment.sh'' finished with non-zero exit value 127

如何在jenkins服务器中下载和配置docker-compose,也没有可用的插件!,用于docker-compose

How can i download and configure docker-compose in jenkins server, also there's no plugin available!, for docker-compose

推荐答案

您的docker-compose可能不存在于$ PATH env变量中.

Probably your docker-compose doesn't exist in your $PATH env variable.

首先,您应删除所有有冲突的docker-compose-

First you should remove any conflicting docker-compose -

rm /usr/local/bin/docker-compose

在大多数Linux系统上,以下是我更喜欢安装docker& docker compose-

On most of the Linux systems, below is how I prefer installing docker & docker compose -

(以超级用户身份运行命令)

(Run commands as root)

curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
usermod -aG docker $YOUR_USER
systemctl enable docker

退出当前的tty&使用$YOUR_USER重新登录.这将始终安装最新的Docker引擎CE& docker-compose(v1.17).

Exit the current tty & login back again with $YOUR_USER. This will always install latest docker engine CE & docker-compose(v1.17).

这篇关于docker-compose:在詹金斯上找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆