C
C
Clank2018-06-30 20:26:27
Docker
Clank, 2018-06-30 20:26:27

How to add ENTRYPOINT to Dockerfile without rewriting CMD?

I took the telegrammessenger / proxy image as a basis and I want to add my program to it, however I cannot make it work inside the container without specifying it in ENTRYPOINT. Dockerfile now looks like this

FROM telegrammessenger/proxy
COPY stats .
CMD [ "/bin/sh", "-c", "/bin/bash /run.sh"]
ENTRYPOINT [ "./stats" ]

CMD [ "/bin/sh", "-c", "/bin/bash /run.sh"]i looked with docker inspect

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rustler2000, 2018-07-01
@rustler2000

Docker launches one single application - the launch line
```${ENTRYPOINT} ${CMD}```
Actually https://docs.docker.com/engine/reference/builder/#cmd - "There can only be one CMD instruction in a Dockerfile."
To run a second application in the same container (which is bad) - you need an entrypoint to do this - for example, as an entrypoint there was a script
```
#!/bin/sh
app1 &
app2
```

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question