自己寫的 Dockerfile
FROM python:3
WORKDIR /home/src/app
COPY requirements.txt /home/src
RUN pip install --no-cache-dir -r /home/src/requirements.txt
CMD [ "python", "app_main.py" ]
EXPOSE 5000
使用 docker run -p 5000:5000 -v src:/home/src/app -ti image 執行
* Serving Flask app 'app_main' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
但是使用 telnet ip:5000 或是 telnet localhost:5000 都只會得到以下結果
Trying ip...
telnet: Unable to connect to remote host: Connection refused
Dockerfile 有 expose,docker run 也有指定 port 但是就是連不到
我有什麼地方搞錯了嗎?
--
FROM python:3
WORKDIR /home/src/app
COPY requirements.txt /home/src
RUN pip install --no-cache-dir -r /home/src/requirements.txt
CMD [ "python", "app_main.py" ]
EXPOSE 5000
使用 docker run -p 5000:5000 -v src:/home/src/app -ti image 執行
* Serving Flask app 'app_main' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
但是使用 telnet ip:5000 或是 telnet localhost:5000 都只會得到以下結果
Trying ip...
telnet: Unable to connect to remote host: Connection refused
Dockerfile 有 expose,docker run 也有指定 port 但是就是連不到
我有什麼地方搞錯了嗎?
--
All Comments