Answer the question
In order to leave comments, you need to log in
How to run a bottle app as a docker container?
I wrote the simplest application on the bottle framework and it works without problems on the localhost. I used virtualenv and pyhton3.
Next, I knocked him out.
Dockerfile:
FROM ubuntu
COPY . .
RUN /bin/bash -c "source venv/bin/activate"
ENTRYPOINT /bin/bash -c "python3 index.py"
(venv) [email protected] ~/python/bottler $ docker build -t bottler .
Sending build context to Docker daemon 26.07MB
Step 1/4 : FROM ubuntu
---> 7698f282e524
Step 2/4 : COPY . .
---> 9e182c969051
Step 3/4 : RUN /bin/bash -c "source venv/bin/activate"
---> Running in 2022e2fa7600
Removing intermediate container 2022e2fa7600
---> 16209d249539
Step 4/4 : ENTRYPOINT python3 index.py
---> Running in 84594de70d72
Removing intermediate container 84594de70d72
---> d5057555ab1a
Successfully built d5057555ab1a
Successfully tagged bottler:latest
docker run -i -t --rm -p 8000:8000 bottler
/bin/bash: python3: command not found
Answer the question
In order to leave comments, you need to log in
1) replace ENTRYPOINT with CMD and read about the difference
2) Inherit from python:3.7, not from ubuntu
3) Do not sculpt a virtual environment in a docker image
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question