portainer / portainer-compose

Compose setup for Portainer
http://portainer.io
681 stars 303 forks source link

error : task: non-zero exit (1) #16

Closed ittony-ma closed 5 years ago

ittony-ma commented 6 years ago

我使用docker stack deploy启动时会报错task: non-zero exit (1), 但是我使用docker run 的方式启动则不会有问题. 我的compose文件如下: portainer: image: portainer/portainer ports:

ran-dall commented 5 years ago

@tony-Ma-yami I was getting this issue. It turned out that I didn't have a /opt directory in root directory. If you look in your docker-compose file there is a volume mounted @ /data to your local /opt/portainer/data directory . I'm on macOS, and that directory (/opt/portainer/data) didn't exist. So I decided to change the value in that volume stanza (the docker-compose file) to a local directory (portainer-compose/data/). That fixed my problem.

So this is what my file looks like...

version: '2'

services:
  proxy:
    build: nginx/
    container_name: "portainer-proxy"
    ports:
      - "80:80"
    networks:
      - local

  templates:
    image: portainer/templates
    container_name: "portainer-templates"
    networks:
      - local

  portainer:
    image: portainer/portainer
    restart: always
    container_name: "portainer-app"
#Automatically choose 'Manage the Docker instance where Portainer is running' by adding <-> to the command
    command: --templates http://templates/templates.json
             --host=unix:///var/run/docker.sock
    networks:
      - local
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer-compose/data:/data

  watchtower:
    image: v2tec/watchtower
    container_name: "portainer-watchtower"
    command: --cleanup portainer-app portainer-watchtower portainer/templates
    networks:
      - local
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

networks:
  local:
    driver: bridge
deviantony commented 5 years ago

Should be fixed via https://github.com/portainer/portainer-compose/pull/20