How to make docker image and

To establish my Django project in Docker, I have done following work.

make image

I make image by Dockfile.

create Dockfile at the root of your project.

the content of Dockerfile:

FROM fw-registry.dev.fwmrm.net/ubuntu
LABEL description="web compare tool" \
      maintainer="****"
WORKDIR /webCompareTool
# COPY . /webCompareTool/requirements.txt
RUN apt-get -qq update
RUN apt-get -qq install python
RUN apt-get -qq -y install python-pip
RUN pip install --upgrade pip
RUN pip install django
RUN pip install bs4
RUN pip install selenium
RUN pip install html2text
RUN pip install pillow
RUN pip install diff_match_patch
RUN apt-get -qq -y install wget
RUN apt-get -qq -y install unzip
RUN wget https://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip
RUN ls
RUN chmod 777 chromedriver
RUN cp chromedriver /usr/bin/
RUN apt-get -qq install chromium-browser
ADD . /webCompareTool/
EXPOSE 5000
RUN python ComDetailPage/manage.py migrate

The rule of Dockfile, follow this https://yeasy.gitbooks.io/docker_practice/image/build.html

Then, build it at the Dockerfile directory.

docker buil web-compare-tool .

Then run ‘docker images’ to see the images you have.

docker images

test running image

To assure our image can run smoothly, we should run the local image firstly, by the command ‘docker run’, for my case, the command to run my project is

docker run -it -p 5000:5000 web-compare-tool python ComDetailPage/manage.py runserver 0.0.0.0:5000

If success, you can visit your website at http://localhost:5000/index

tag image

Before push the image, we have to tag it.

docker tag image_id[:tag] private_repo/username/image_name[:tag]

push image

Finally, we can push the tagged image into the reposity by

docker push private_repo/username/image_name[:tag]

you will get a url to visit your image after successfully pushing it.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值