我正在尝试设置一个使用Docker容器提供的数据库服务的Bitbucket管道。但是,为了使数据库服务正确启动,我需要传递数据库容器的入口处接收的参数。我从可以将变量发送到服务的Docker容器,但是我需要设置的选项无法通过环境变量来设置,只能通过命令行参数来设置。
当我使用 docker Run
在本地运行数据库的Docker映像时,我可以通过将其添加到 Docker Run
命令的末尾来设置该选项,然后才能正确地设置该选项应用于容器的入口点,因此似乎应该很简单,我只是不知道将参数放在bitbucket-pipelines.yml中。
下面是我的bitbucket Pipelines.yml。关于它的一切都很好,除了我需要一种方法将命令行参数传递给文件末尾的Victoria-Metrics容器。
image: node:14.16.1
pipelines:
default:
- step:
caches:
- node
script:
- npm install
- npm test
services:
- mongo
- victoriaMetrics
definitions:
services:
mongo:
image: mongo:3.6
victoriaMetrics:
image: victoriametrics/victoria-metrics:v1.75.1
I am trying to set up a bitbucket pipeline that uses a database service provided by a docker container. However, in order to get the database service started correctly, I need to pass an argument to be received by the database container's ENTRYPOINT. I see from the pipeline service doc that it's possible to send variables
to the service's docker container, but the option I need to set isn't settable by an environment variable, only by a command line argument.
When I run the database's docker image locally using docker run
, I am able to set the option just by adding it to the end of the docker run
command, and it gets correctly applied to the container's ENTRYPOINT, so it seems like this should be straightforward, I just can't figure out where to put the argument in bitbucket-pipelines.yml.
Below is my bitbucket-pipelines.yml. Everything about it works great except that I need a way to pass a command line argument to the victoria-metrics container at the end of the file.
image: node:14.16.1
pipelines:
default:
- step:
caches:
- node
script:
- npm install
- npm test
services:
- mongo
- victoriaMetrics
definitions:
services:
mongo:
image: mongo:3.6
victoriaMetrics:
image: victoriametrics/victoria-metrics:v1.75.1
发布评论
评论(2)
据 Atlassian 的 Mark C 称,目前有 无法将命令行参数传递给服务容器。不过,他为此功能创建了功能请求,欢迎您投票支持如果有兴趣。
同时,建议的解决方法是:
According to Mark C from Atlassian, there is presently no way to pass command line arguments to service containers. However, he has created a feature request for this capability, which you are welcome to vote for if interested.
In the meantime, the suggested workarounds are:
这对我有用:
This worked for me: