如何将参数传递给 docker-compose.yml 中的入口点 [英] How to pass arguments to entrypoint in 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.
推荐答案
command
子句确实像上面@Karthik 所说的那样工作.
The command
clause does work as @Karthik says above.
作为一个简单的例子,当运行 docker-compose up
时,以下服务将在其 ENTRYPOINT
中添加一个 -inMemory
.
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屋!