Skip to content

datastore returns exited with code 0 #4148

Closed

Description

@chansuke
  • docker for mac(Version:1.12.3-beta30
  • docker-compose(Version:1.9.0-rc4, build 181a4e9)

I am running docker-compose with the file below,but always fail with datastore.It returns sampleapp_datastore_1 exited with code 0.

version: "2"
services:

  datastore:
    image: busybox
    volumes:
      - postgres-data:/var/lib/postgres/data

  postgres:
    image: postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
    ports:
      - '5432:5432'
    volumes_from:
      - datastore
  app:
    build: .
    ports:
      - '3000:3000'
    links:
      - postgres
    volumes_from:
      - datastore
    command: bundle exec rails s -b "0.0.0.0"

volumes:
  postgres-data:
    driver: local

Activity

  1. shin- commented on Nov 14, 2016

    @shin-

    You don't need a datastore service. Simply reference the named volume directly in your postgres service definition (see below).

    version: "2"
    services:
      postgres:
        image: postgres
        environment:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: password
        ports:
          - '5432:5432'
        volumes:
          - postgres-data:/var/lib/postgres/data
      app:
        build: .
        ports:
          - '3000:3000'
        links:
          - postgres
        command: bundle exec rails s -b "0.0.0.0"
    
    volumes:
      postgres-data:
        driver: local
  2. shin- commented on Nov 14, 2016

    @shin-

    But to answer the original question, the reason datastore exits with code 0 is because you don't define a command to be run. It's not an error, just means the container doesn't have anything to run and terminates as result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions