S
S
semki0962017-04-07 01:16:13
Docker
semki096, 2017-04-07 01:16:13

How to write the passed parameters to the container file when starting the container (docker)?

I create a container and pass parameters

docker run --name my-conteiner -it my-image php -r "hello world"

That's how it works. But if I want to write "hello world" to some file inside the container when starting the container, can I do it directly from docker run?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Axian Ltd., 2017-04-07
@semki096

docker run --name my-conteiner -it my-image command_that_writes_to_file
The same php in your case will write to the container.
An elegant version with a Dockerfile, for example, is described here stackoverflow.com/questions/40238969/how-to-pass-c...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question