Z
Z
zlodiak2019-07-02 16:08:54
Python
zlodiak, 2019-07-02 16:08:54

Why won't the site container start?

I created a simple two-page website and made a docker container out of it. Here is the contents of the Dockerfile:

FROM python:3-onbuild

WORKDIR /app

ADD . /app

RUN pip install -r requirements.txt

EXPOSE 80

CMD ["python", "index.py"]

the problem is that right after starting the container it stops.
(venv) [email protected] ~/python/out/bottle_out $ docker build -t bottle_out .
Sending build context to Docker daemon  33.99MB
Step 1/6 : FROM python:3-onbuild
# Executing 3 build triggers
 ---> Running in 20824b5ffcdc
Collecting bottle==0.12.17 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/69/d1/efdd0a5584169cdf791d726264089ce5d96846a8978c44ac6e13ae234327/bottle-0.12.17-py3-none-any.whl (89kB)
Installing collected packages: bottle
Successfully installed bottle-0.12.17
You are using pip version 10.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Removing intermediate container 20824b5ffcdc
 ---> ee085344e970
Step 2/6 : WORKDIR /app
 ---> Running in 6a30d114c0ef
Removing intermediate container 6a30d114c0ef
 ---> 86deee5f69f4
Step 3/6 : ADD . /app
 ---> 08a8ef43eddf
Step 4/6 : RUN pip install -r requirements.txt
 ---> Running in 8c0a51afe0e8
Requirement already satisfied: bottle==0.12.17 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (0.12.17)
You are using pip version 10.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Removing intermediate container 8c0a51afe0e8
 ---> 4206bd7f94cd
Step 5/6 : EXPOSE 80
 ---> Running in 5db44ea0d87e
Removing intermediate container 5db44ea0d87e
 ---> b6ba325b1b55
Step 6/6 : CMD ["python", "index.py"]
 ---> Running in 4a8006b13b80
Removing intermediate container 4a8006b13b80
 ---> b220d626810f
Successfully built b220d626810f
Successfully tagged bottle_out:latest
(venv) [email protected] ~/python/out/bottle_out $ docker images
REPOSITORY                                      TAG                 IMAGE ID            CREATED             SIZE
bottle_out                                      latest              b220d626810f        5 seconds ago       762MB
python                                          3-onbuild           292ed8dee366        12 months ago       691MB
(venv) [email protected] ~/python/out/bottle_out $ docker run -d bottle_out
116ab60dd88365909c983e5b2825819fe98567e40117ff9f3767d88874f8c4dc
(venv) [email protected] ~/python/out/bottle_out $ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
116ab60dd883        bottle_out          "python index.py"   9 seconds ago       Exited (1) 8 seconds ago                       agitated_lumiere

And I expected that it will start in this container and through port 5000 it will be available in my OS. That is, at least the container should not close immediately.
Please tell me what is the problem?
Full repository here .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2019-07-02
@fox_12

At least go inside the container and run what you wrote there.
You only have bottle==0.12.17 in requirements.txt, and you still use some of the modules - the same psycopg2. You have it and it crashes with an error after launch.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question