0

There are 2 issues I am facing while running this image :

Dockerfile :

# cat Dockerfile 
FROM ubuntu:14.04
MAINTAINER "RAGHU" <raghavendralokineni@gmail.com>
RUN apt-get update && apt-get install -y python3.4 python-pip python-dev build-essential
RUN pip install flask
COPY welcome-page/ /root/
EXPOSE 5010
CMD ["python /root/mypage_bkp/login.py", "-D", "FOREGROUND"]
root@labadmin-VirtualBox:~/RAGHU/WEBPAGE# 

Running the image :

# docker run -d webpage:2.0 
6f32eb7bf8c9eb41aaece84b861e33055d8ed1066805af064e65d291944fdd04
docker: Error response from daemon: oci runtime error: exec: "python /root/mypage_bkp/login.py": stat python /root/mypage_bkp/login.py: no such file or directory.

ISSUE 1 : Why is the above error shown, even though the file present ?

Running the same image with a different CMD :

 # docker run -itd webpage:2.0 /bin/bash
92950bf69de9f5696557a34eecf1d926b65a96aebdc86e529c208d4a2198534e

# docker exec -it 92950bf69de9 /bin/bash
root@92950bf69de9:/# cd /root/
root@92950bf69de9:~# ls
README.md  mypage_bkp
root@92950bf69de9:~# cd mypage_bkp/
root@92950bf69de9:~/mypage_bkp# ls
database.pyc  login.py  names.db  static  templates
root@92950bf69de9:~/mypage_bkp# pwd
/root/mypage_bkp

Able to run the same application in the same way as mentioned in Docker file:

root@92950bf69de9:~/mypage_bkp# python /root/mypage_bkp/login.py 
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger pin code: 270-194-240

ISSUE 2: I have run the application manually as above and unable to connect to the container from host.

What I mean here is, the application should be available to the host machine with IP address allocated to the container and PORT exposed. When I open the IP:172.17.0.2:5010 in firefox on my host machine I don't see any output:

# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
92950bf69de9        webpage:2.0         "/bin/bash"         40 minutes ago      Up 40 minutes       5010/tcp            cranky_jang

# docker inspect 92950bf69de9 | grep -i ipaddr
     "SecondaryIPAddresses": null,
     "IPAddress": "172.17.0.2",
             "IPAddress": "172.17.0.2",
root@labadmin-VirtualBox:/home/labadmin# ^C

Code for application is copied at https://github.com/Raghavendarlokineni/welcome-page/tree/master/mypage_bkp

Please help me in understanding the issues I am facing.

Here_2_learn
  • 5,013
  • 15
  • 50
  • 68
  • 1. What errors? 2. The IP has a typo and you also have to give the port. – Klaus D. Nov 27 '16 at 08:19
  • when you see `docker: Error response from daemon: oci runtime error: exec:` this means something is wrong in the CMD, so find what is wrong and rebuild your image – user2915097 Nov 27 '16 at 08:45
  • I would try `CMD ["python", "/root/mypage_bkp/login.py", "-D", "FOREGROUND"]` to begin with, check the doc https://docs.docker.com/engine/reference/builder/#/cmd, you have 3 possible ways, but you can't mix them, and having one field containing `python /root/mypage_bkp/login.py` is not correct – user2915097 Nov 27 '16 at 08:46
  • @user2915097: Thanks for that, it worked as you have suggested..any suggestions to resolve the second one... – Here_2_learn Nov 27 '16 at 15:58
  • Your path has VirtualBox in it, are you running docker inside a VM? If so, are you also opening firefox inside the the VM or on the host? – Roman Nov 27 '16 at 16:03
  • @R0MANARMY: Firefox in VM(which is host machine for the docker container) – Here_2_learn Nov 27 '16 at 16:07
  • as you use EXPOSE, you `docker run` lacks some `-p 5010:5010` – user2915097 Nov 27 '16 at 17:34
  • @user2915097 : even tried that , not helping for me...what I think is that my application in the container by default "Running on http://127.0.0.1:5000/" . Should be some problem in mapping the application IP and port to host machine. – Here_2_learn Nov 28 '16 at 06:40
  • check with `docker exec -it container_id bash` and debug with `netstat -an` or `lsof -i:5000` – user2915097 Nov 28 '16 at 08:57
  • @user2915097: Following is the info : root@b6e09e6b4d18:/# netstat -an Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path root@b6e09e6b4d18:/# lsof -i:5000 root@b6e09e6b4d18:/# Does it gives any info ?? – Here_2_learn Nov 29 '16 at 02:17
  • so inside your container the port 5000 listens, but not on the host – user2915097 Nov 29 '16 at 13:09
  • Let me know if you need any further details to debug this issue... It would be helpful for me.. – Here_2_learn Nov 29 '16 at 13:13

0 Answers0