dockerdocker-composedocker-for-mac

docker-compose up vs docker-compose up service1 service2


I have the following docker-compose file below. If I run docker-compose up everything functions properly. If I do however docker-compose up minio1 minio2 minio3 minio4 the volumes are not created, and I do not see the following logs. It does not create the volumes I am assuming. I have many other services in the real docker-compose.yml file, I don't want to run docker-compose up and start every service all the time. How do I only start those 4 services AND create volumes/networks?

This does not appear with docker-compose up minio1 minio2 ...

Creating volume "robot_models1" with default driver
Creating volume "robot_models2" with default driver  
Creating volume "robot_models3" with default driver  
Creating volume "robot_models4" with default driver

docker-compose.yml

version: '3'
services:
  minio1:
    image: minio/minio:RELEASE.2018-07-10T01-42-11Z
    volumes:
      - models1:/export
    ports:
      - "9001:9000"
    environment:
      MINIO_ACCESS_KEY: access123123
      MINIO_SECRET_KEY: secret123123
    command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export

  minio2:
    image: minio/minio:RELEASE.2018-07-10T01-42-11Z
    volumes:
      - models2:/export
    ports:
      - "9002:9000"
    depends_on:
      - minio1
    environment:
      MINIO_ACCESS_KEY: access123123
      MINIO_SECRET_KEY: secret123123
    command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export

  minio3:
    image: minio/minio:RELEASE.2018-07-10T01-42-11Z
    volumes:
      - models3:/export
    ports:
      - "9003:9000"
    depends_on:
      - minio2
    environment:
      MINIO_ACCESS_KEY: access123123
      MINIO_SECRET_KEY: secret123123
    command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export

  minio4:
    image: minio/minio:RELEASE.2018-07-10T01-42-11Z
    volumes:
      - models4:/export
    ports:
      - "9004:9000"
    depends_on:
      - minio3
    environment:
      MINIO_ACCESS_KEY: access123123
      MINIO_SECRET_KEY: secret123123
    command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export

  ## By default this config uses default local driver,
  ## For custom volumes replace with volume driver configuration.
volumes:
  models1:
  models2:
  models3:
  models4:

docker-compose version:

docker-compose version 1.21.2, build a133471
docker-py version: 3.4.1
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.0.2o  27 Mar 2018

Solution

  • Try:

    docker-compose up -d minio1 minio2 minio3 minio4

    This worked for me