简体   繁体   中英

Docker container showing “not found” for entrypoint command

I am just simply trying to pass some arguments to my ENTRYPOINT command, but it keep showing not found in its output.

Here's what my Dockerfile has at the end:

ENTRYPOINT "/usr/bin/amazon-ssm-agent -region us-east-2 -register -code $ACTIVATION_CODE -id $ACTIVATION_ID"

I get the error when running the following command:

root@docker-test:~/# docker run -ti -e ACTIVATION_CODE=9SHHXJPYgbPaxZbnpV+ -e ACTIVATION_ID=a1a91393-b9c8-4000-b76e-e6fc9f8940b5 6977e8135eb8 /bin/bash
/bin/bash: 1: /usr/bin/amazon-ssm-agent -region us-east-2 -register -code 9SHHXJPYgbPaxZbnpV+ -id a1a91393-b9c8-4000-b76e-0: not found

The amazon-ssm-agent command exists but I'm not quite sure what it means by "not found". Does that mean the command is not found or something else?

That is not a valid form for the ENTRYPOINT directive. You can choose between the exec form (the preferred one) and the shell form. More here .

In your case:

ENTRYPOINT ["sh", "-c", "/usr/bin/amazon-ssm-agent -region us-east-2 -register -code $ACTIVATION_CODE -id $ACTIVATION_ID"]

you have to call the shell ( sh ) in order to enable the variable substitution. Alternatively, the shell form:

ENTRYPOINT /usr/bin/amazon-ssm-agent -region us-east-2 -register -code $ACTIVATION_CODE -id $ACTIVATION_ID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM