M
M
Mike Goodwin2019-02-22 21:52:23
bash
Mike Goodwin, 2019-02-22 21:52:23

How to modify docker-compose.yml to run sh script in container after it is up? How to execute cmd command inside container automatically?

Hello. There is a docker-compose.yml file in which the service uses a standard image.
What needs to be done in order to execute a command in cmd inside the container after raising the container, or how to execute the script inside the container in automatic mode after raising it?
It is docker-compose.yml that is used. Dockerfile missing.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2019-02-22
@fox_12

And what is the difficulty?
docker-compose.yml

...
     <какой-то контейнер>:
         image: <какой-то стандартный образ>
         ...
         entrypoint: <какая-то команда которую нужно запустить в автоматическом режиме>

If you are afraid that the standard image entry script will not start, then take a look at what starts there and change the command like this:
...
    <какой-то контейнер>:
         image: <какой-то стандартный образ>
         ...
         entrypoint: <ваша команда> && <старт стандартной точки входа образа>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question