本文介绍了引用第一个参数传递给docker entrypoint?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试获取我传递给Docker Entrypoint的第一个参数的值。我早些时候收到了一个答案,就如何做到这一点。以下是链接:
I'm trying to obtain the value of the first argument I pass to the Docker Entrypoint. I received an answer earlier on how to do this. Here is the link:
在Docker Entrypoint中引用一个动态参数
所以我设置一个实验,看看是否有效:
So I setup an experiment to see if this works:
这是我的Dockerfile:
Here's my Dockerfile:
FROM alpine:3.3 MAINTAINER ole.ersoy@gmail RUN apk add --update --no-cache --no-progress bash COPY run.sh . ENTRYPOINT /run.sh而$ code> run.sh entrypoint:
And the run.sh entrypoint:
#!/bin/sh echo The first argument is: $1然后我建立这个:
docker build -t test .并运行图像:
ole@MKI:~/docker-test$ docker run test one The first argument is:我期待:
ole@MKI:~/docker-test$ docker run test one The first argument is: one想法?
TIA, Ole
TIA, Ole
推荐答案将ENTRYPOINT更改为下一个:
Change ENTRYPOINT to next:
ENTRYPOINT ["bash", "run.sh"]它适用于我。在这里阅读更多关于entrypoint参考的 docs.docker/engine/reference/生成器/#entrypoint
It works for me. Read more about entrypoint args here docs.docker/engine/reference/builder/#entrypoint
更多推荐
引用第一个参数传递给docker entrypoint?
发布评论