Reputation: 21
I am trying to build a Docker Img for a python program(It's a telegram Bot from FreeCodeCamp), Now the code runs perfectly but when I try to build this Dockerfile
FROM python:3.6
COPY . /app
WORKDIR /app
RUN pip install -r requirement.txt
ENV PORT 8080
ENV HOST 0.0.0.0
RUN ["python","bot.py"]
The system hangs.
dishant_sonawane17@cloudshell:~/project (voice-261819)$ docker build -t python-docker-dev .
Sending build context to Docker daemon 4.608kB
Step 1/7 : FROM python:3.6
---> e0373ff33a19
Step 2/7 : COPY . /app
---> Using cache
---> 6f9396ff2a64
Step 3/7 : WORKDIR /app
---> Using cache
---> 1c216f1a529c
Step 4/7 : RUN pip install -r requirement.txt
---> Using cache
---> 531e40ac101d
Step 5/7 : ENV PORT 8080
---> Using cache
---> 385b36f30518
Step 6/7 : ENV HOST 0.0.0.0
---> Using cache
---> b1ba2f0bf26e
Step 7/7 : RUN ["python","bot.py"]
---> Running in 5ceec7069ee9
Upvotes: 0
Views: 1318
Reputation: 919
Not sure what your bot.py
will do, but it will run and wait to finish...
It looks like you want bot.py
to be the application to start once the container is started.
You should use ENTRYPOINT
or CMD
for this.
In a nutshell:
RUN
executes command(s) in a new layer and creates a new image. E.g., it is often used for installing software packages.CMD
sets default command and/or parameters, which can be overwritten from command line when docker container runs.ENTRYPOINT
configures a container that will run as an executable.
More detailed explanation/source: https://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/.
Upvotes: 2