D
D
Dmitry Baskakov2021-07-12 11:40:14
Docker
Dmitry Baskakov, 2021-07-12 11:40:14

How to run a command (doctrine migration) through a completed container?

There is a cli container through which you can run commands with some kind of magic. The container itself contains some basic advanced settings and dependencies for everything to work correctly. However, there is a problem - I do not know how to use it, because when you start it immediately exits, which seems to be the norm for him. Plus, the command has already been run through it once, only now I forgot how.

And the question is: how can I run a command through the released container? If important, then the doctrine migration command

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2021-07-12
@dmitrybascacov

If you just run
docker run --rm -i <имя образа>:[тэг]
If you transfer, you need to throw some file or config into the container:

docker run --rm -i -v <файл на хостовой машине>:<файл в контейнере> <имя образа>:[тэг]

If the program in the container needs to submit something to the standard input: You can search for the command that you entered but forgot in the command history...
docker run --rm -i <имя образа>:[тэг] < "данные"

D
Dmitry Baskakov, 2021-07-13
@dmitrybascacov

Alternative solution:
docker-compose run <cotainer-name> <command>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question