F
F
First Name2018-06-15 21:57:50
Docker
First Name, 2018-06-15 21:57:50

How to throw an argument into a container?

Hello everyone, I started studying a docker course and there is a task

When starting a container from this image without arguments, it should print the string ''Hello World!' and exit.
When starting the container with an argument, the string ''Hello !

Created Dockerfile
FROM ubuntu:14.04

ENTRYPOINT ["echo"]
CMD ["Hello Wordl!"]

Those. run
docker build -t test .
docker run --rm test
Outputs "Hello Wordl!"
docker run --rm test string
Displays "string
"
I ask you not to throw slippers, the documentation did not help, just like the whole Google.
Thank you in advance for your response.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Tsvetkov, 2018-06-15
@yellow79

FROM alpine
ENTRYPOINT [ "echo", "hello" ]
CMD [ "world" ]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question