I am new to container, below questions might sound stupid.
There are two questions actually.
I have a non-web python application fully tested in VScode without any error, then I use below Dockerfile to build it locally.
FROM python:3.8-slim
WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "./mycode.py"]
An image was built successfully, but running ended with a TypeError. I have made sure the requirements.txt has same dependency as in my project environment. The error message is "wrong tuple index" which gives me no clue on where the problem could come from a fully tested code. I am stuck here with a weird feeling.
worker: python mycode.py
An image was built successfully, but docker run could not launch the application with below error. I have no idea about what else beside "worker:" could launch a non-web python application in Procfile. Stuck again!ERROR: failed to launch: determine start command: when there is no default process a command is required
I searched but all are about web application with "web:" in Procfile. Any help on either question will be appreciated.
When you start the container, you'll need to pass it the worker
process type like this:
$ docker run -it myapp worker
Then it should run the the command you added to the Procfile
.
A few other things:
heroku/python
buildpack or another buildpack that includes Procfile
detection.worker
process type was createdweb:
process type if you do not want to add worker
to your start command. There's nothing wrong with a web:
process that does run web app