如何使用Dockerfile运行Google应用引擎服务器
我是新来的docker,我需要在谷歌应用程序引擎服务器使用Dockerfile运行web2py应用程序,为此我创build了dockerfile来安装python,gae服务器和我的web2py源文件夹。
我的问题是如何使用Dockerfile启动gae服务器,以及如何将现有的源代码configuration到gae中,以及如何运行gae服务器以在基于docker运行容器IP的浏览器上查看我的应用程序login页面
这里是我的Dockerfile
FROM ubuntu:trusty MAINTAINER John #install python RUN sudo apt-get install python --assume-yes RUN apt-get install -y wget unzip #install GAE RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud- sdk.zip && unzip google-cloud-sdk.zip && rm google-cloud-sdk.zip RUN google-cloud-sdk/install.sh --usage-reporting=true --path-update=true -- bash-completion=true --rc-path=/.bashrc --additional-components app-engine-python ENV PATH /google-cloud-sdk/bin:$PATH COPY Testapp/ . RUN pwd WORKDIR Testapp CMD python web2py.py #Expose the ports EXPOSE 8081 ENTRYPOINT ["/Testapp/web2py"] #CMD ["python", "/Testapp/web2py.py"] CMD ["/bash/"]
尝试:
FROM ubuntu:trusty MAINTAINER Chandra #install python RUN apt-get install -y -qq wget python unzip #install GAE RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.zip && unzip google-cloud-sdk.zip && rm google-cloud-sdk.zip RUN google-cloud-sdk/install.sh --usage-reporting=true --path-update=true --bash-completion=true --rc-path=/.bashrc --additional-components app-engine-python ENV PATH /google-cloud-sdk/bin:$PATH WORKDIR CFSA_Testapp COPY CFSA_Testapp/ . RUN pwd CMD python guestbook.py #Expose the ports EXPOSE 8080 CMD ["dev_appserver.py", "--host=0.0.0.0", "."]
我使用Google的示例应用程序对其进行testing,只需将其放入CFSA_Testapp
文件夹即可。
你可以运行docker run -it --rm -p 8080:8080 image_name
。
然后,您只需在localhost:8080
上打开浏览器,就完成了。