首页 > 解决方案 > 如何使用 Azure devops docker-compose 任务推送 docker-compose 服务?

问题描述

我正在尝试使用 docker-compose 构建和推送 ElasticSearch 的图像。我正在使用经典编辑器,但无法将其推送到注册表。

docker-compose up 命令将构建映像并在本地和构建管道主机上运行容器,但使用 -d 选项不会。

我错过了什么?

services:
  odfe-node1:
    image: amazon/opendistro-for-elasticsearch:1.13.2
    container_name: odfe-node1
    environment:
      - cluster.name=odfe-cluster
      - node.name=odfe-node1
      - discovery.seed_hosts=odfe-node1
      - cluster.initial_master_nodes=odfe-node1
      - bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536 # maximum number of open files for the Elasticsearch user, set to at least 65536 on modern systems
        hard: 65536
    volumes:
      - odfe-data1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9600:9600 # required for Performance Analyzer
    networks:
      - odfe-net
  kibana:
    image: amazon/opendistro-for-elasticsearch-kibana:1.13.2
    container_name: odfe-kibana
    ports:
      - 5601:5601
    expose:
      - "5601"
    environment:
      ELASTICSEARCH_URL: https://odfe-node1:9200
      ELASTICSEARCH_HOSTS: https://odfe-node1:9200
    networks:
      - odfe-net

volumes:
  odfe-data1:

networks:
  odfe-net:

构建管道任务

向上

steps:

- task: DockerCompose@0

  displayName: 'up -d'

  inputs:

    azureSubscription: '***'

    azureContainerRegistry: '{"loginServer":"***", "id" : "/subscriptions/***/resourceGroups/***/providers/Microsoft.ContainerRegistry/registries/***"}'

    dockerComposeFile: 'docker-compose.yml'

    dockerComposeCommand: up

steps:

- task: DockerCompose@0

  displayName: 'Run a Docker Compose command'

  inputs:

    azureSubscription: '***'

    azureContainerRegistry: '{"loginServer":"***", "id" : "/subscriptions/***/resourceGroups/***/providers/Microsoft.ContainerRegistry/registries/***"}'

    dockerComposeCommand: 'push kibana'

标签: elasticsearchazure-devops

解决方案


推荐阅读