将服务参数传递给docker-compose up

时间:2016-06-23 08:38:25

标签: docker docker-compose

我有以下docker-compose.yml:

version: '2'
services:
  strongloop:
    image: node:5.11-onbuild
    links:
      - mongodb
  mongodb:
    image: mongo:3.3
    volumes:
      - ./mongo/mongo.conf:/etc/mongo.conf

现在我需要使用标志-f /etc/mongo.conf启动mongodb服务,并行启动strongloop服务并链接它们。到目前为止,我用docker-compose up做了这个,因为我不需要一些标志。

如何将此标记传递给docker-compose up

或者是否有其他命令链接容器以及我可以将某些参数传递给特定服务的位置?

编辑:

docker-compose up mongodb -f /etc/mongo.conf strongloop返回ERROR: No such service: -f

docker-compose up "mongodb -f /etc/mongo.conf" strongloop 返回ERROR: No such service: mongodb -f /etc/mongo.conf

1 个答案:

答案 0 :(得分:1)

您应该更改docker-compose.yml,如下所示:

CREATE PROCEDURE Delete_ThreeTablesData
    @UserId INT
AS
BEGIN
    DELETE FROM Fruit 
    WHERE FruitId = (SELECT TOP 1 FruitId 
                     FROM UserFruitMapping   
                     WHERE UserId  = @UserId)

    DELETE FROM UserFruitMapping 
    WHERE UserId  = @UserId

    DELETE FROM User 
    WHERE UserId  = @UserId
END

之后,只需运行:

version: '2'
services:
  strongloop:
    image: node:5.11-onbuild
    links:
      - mongodb
  mongodb:
    image: mongo:3.3
    command: mongod -f /etc/mongo.conf
    volumes:
      - ./mongo/mongo.conf:/etc/mongo.conf