A
A
akass2017-04-12 16:24:09
tomcat
akass, 2017-04-12 16:24:09

How to start a container with a script and not stay in the output?

I will ask a question using the example of the image of the tomcat.
By default, when the container starts, the tomcat starts immediately, which suits me, but in this case, when attaching, I get into its output and cannot, for example, edit the configs.
If I run it with the /bin/bash command, then everything is fine and I can work, but then, of course, the tomcat does not start.
How to be? Haven't worked with Dockerfile yet.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2017-04-13
@akass

Do docker exec _container_name_ bash or docker-compose exec _service_name_ bash
Opens a bash in a container for you, edit what you need and exit ctrl-D
The main process will not be affected.
In principle, this is ideologically wrong, the configs would need to be mounted from outside the container and edited from the host axis. I go inside only to fix something that is not working, to find out the reasons on the spot, and only then make the necessary fixes in the Dockerfile

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question