如何在docker-compose.yml中将参数传递给入口点 [英] How to pass arguments to entrypoint in docker-compose.yml

查看:243
本文介绍了如何在docker-compose.yml中将参数传递给入口点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此图像:dperson / samba

I use this image: dperson/samba

该图像定义了它自己的入口点,我不想覆盖它。

The image is defining it's own entrypoint and I do not want to override it.

我需要将参数传递给入口点,仅适用于docker:

I need to pass arguments to the entrypoint, easy with docker only:

docker run ... dperson/samba arg1 arg2 arg3

但是如何使用docker_compose.yml呢?

But how to do it with docker_compose.yml ?

现在我用作解决方法:

command: samba.sh arg1 arg2 arg3

但这并不令人满意,因为我强制重新定义了入口点。

But it is not satisfying as I force the redefinition of the entrypoint.

推荐答案

命令子句确实如上述@Karthik所说的那样工作。

The command clause does work as @Karthik says above.

作为一个简单的示例,以下服务将在其 ENTRYPOINT 中添加 -inMemory 当运行 docker-compose up 时。

As a simple example, the following service will have a -inMemory added to its ENTRYPOINT when docker-compose up is run.

version: '2'
services:
  local-dynamo:
    build: local-dynamo
    image: spud/dynamo
    command: -inMemory

这篇关于如何在docker-compose.yml中将参数传递给入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆