docker: 部署python项目

2年前 (2018-05-02) gtj docker, 虚拟化 0评论 已收录 225℃

1.下载ubuntu镜像
sudo docker pull ubuntu
[sudo] password for upsmart:
Using default tag: latest
latest: Pulling from library/ubuntu
a48c500ed24e: Pull complete
1e1de00ff7e1: Pull complete
0330ca45a200: Pull complete
471db38bcfbf: Pull complete
0b4aba487617: Pull complete
Digest: sha256:c8c275751219dadad8fa56b3ac41ca6cb22219ff117ca98fe82b42f24e1ba64e
Status: Downloaded newer image for ubuntu:latest

2.进入ubuntu容器交互系统:
sudo docker run -i -t ubuntu /bin/bash
root@25107923f302:/#

3.ubuntu下安装python:
apt-get update
apt-get install python3
apt-get install python3-pip
pip3 install numpy
pip3 install scipy

4.打包镜像
sudo docker commit 25107923f302 python
查看镜像
sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
pythontongfudun latest 57d01ad0f952 8 minutes ago 821MB

5.导出镜像
sudo docker save -o /opt/python.tar python

6.导入镜像
sudo docker import /opt/python.tar python

博主

这货来去如风,什么鬼都没留下!!!

相关推荐

嗨、骚年、快来消灭0回复。

×
订阅图标按钮
Less is more!!!