安装docker
yum -y install docker
设置开机自启动并开启服务
[root@k8s-master ~]# chkconfig docker on
[root@k8s-master ~]# service docker start
启动docker后台服务
service docker start
测试运行 hello-world
[root@runoob ~]#docker run hello-world
docker pull julienstroheker/pythonflask
[root@docker ~]# setenforce 0
[root@docker ~]# sudo docker run -v $PWD/myapp:/usr/src/myapp -w /usr/src/myapp python:3.5 python abc.py
Traceback (most recent call last):
File "abc.py", line 1, in <module>
from flask import Flask,render_template,request
ImportError: No module named 'flask'
0 [OK]
[root@docker ~]# docker search python
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/python Python is an interpreted, interactive, obj... 2543 [OK]
docker.io docker.io/django Django is a free web application framework... 630 [OK]
docker.io docker.io/pypy PyPy is a fast, compliant alternative impl... 125 [OK]
docker.io docker.io/kaggle/python Docker image for Python scripts run on Kaggle 84 [OK]
docker.io docker.io/amazon/aws-eb-python AWS Elastic Beanstalk Python Image 18
docker.io docker.io/centos/python-35-centos7 Platform for building and running Python 3... 18
docker.io docker.io/resin/raspberrypi3-python The Python buildpack image for Python apps... 14
docker.io docker.io/iron/python Tiny Python Microcontainer 8
docker.io docker.io/centos/python-27-centos7 Platform for building and running Python 2... 7
docker.io docker.io/circleci/python Python is an interpreted, interactive, obj... 5
docker.io docker.io/resin/raspberrypi3-alpine-python The Python buildpack image for Python apps... 4
docker.io docker.io/centos/python-34-centos7 Platform for building and running Python 3... 2
docker.io docker.io/komand/python-plugin Komand Python SDK 2 [OK]
docker.io docker.io/resin/beaglebone-black-python The Python buildpack image for Python apps... 2
docker.io docker.io/qbtrade/python python 3.5.0 with requirements 0
docker.io docker.io/resin/artik10-alpine-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/artik10-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/artik5-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/artik710-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/beaglebone-green-wifi-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/nitrogen6x-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/odroid-c1-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/qemux86-64-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/qemux86-alpine-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/qemux86-python The Python buildpack image for Python apps... 0
[root@docker ~]# docker search pythonflask
INDEX NAME DESCRIPTION
sudo docker run -p 5001:9999 -v $PWD/myapp:/usr/src/myapp -w /usr/src/myapp julienstroheker/pythonflask python abc.py
docker ps -a
docker ps -l
docker ps
mkdir /dockerfile
vi dockerfile
FROM python:3.5
ADD . /dockerfile
WORKDIR /dockerfile
RUN pip install -r requirements.txt
RUN python abc.py
vi requirements.txt
flask
redis
docker build -t python_re .
docker images
docker tag python_re sumourn/python_re
docker push sumourn/python_re
yum -y install docker
设置开机自启动并开启服务
[root@k8s-master ~]# chkconfig docker on
[root@k8s-master ~]# service docker start
启动docker后台服务
service docker start
测试运行 hello-world
[root@runoob ~]#docker run hello-world
docker pull julienstroheker/pythonflask
[root@docker ~]# setenforce 0
[root@docker ~]# sudo docker run -v $PWD/myapp:/usr/src/myapp -w /usr/src/myapp python:3.5 python abc.py
Traceback (most recent call last):
File "abc.py", line 1, in <module>
from flask import Flask,render_template,request
ImportError: No module named 'flask'
0 [OK]
[root@docker ~]# docker search python
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/python Python is an interpreted, interactive, obj... 2543 [OK]
docker.io docker.io/django Django is a free web application framework... 630 [OK]
docker.io docker.io/pypy PyPy is a fast, compliant alternative impl... 125 [OK]
docker.io docker.io/kaggle/python Docker image for Python scripts run on Kaggle 84 [OK]
docker.io docker.io/amazon/aws-eb-python AWS Elastic Beanstalk Python Image 18
docker.io docker.io/centos/python-35-centos7 Platform for building and running Python 3... 18
docker.io docker.io/resin/raspberrypi3-python The Python buildpack image for Python apps... 14
docker.io docker.io/iron/python Tiny Python Microcontainer 8
docker.io docker.io/centos/python-27-centos7 Platform for building and running Python 2... 7
docker.io docker.io/circleci/python Python is an interpreted, interactive, obj... 5
docker.io docker.io/resin/raspberrypi3-alpine-python The Python buildpack image for Python apps... 4
docker.io docker.io/centos/python-34-centos7 Platform for building and running Python 3... 2
docker.io docker.io/komand/python-plugin Komand Python SDK 2 [OK]
docker.io docker.io/resin/beaglebone-black-python The Python buildpack image for Python apps... 2
docker.io docker.io/qbtrade/python python 3.5.0 with requirements 0
docker.io docker.io/resin/artik10-alpine-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/artik10-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/artik5-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/artik710-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/beaglebone-green-wifi-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/nitrogen6x-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/odroid-c1-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/qemux86-64-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/qemux86-alpine-python The Python buildpack image for Python apps... 0
docker.io docker.io/resin/qemux86-python The Python buildpack image for Python apps... 0
[root@docker ~]# docker search pythonflask
INDEX NAME DESCRIPTION
sudo docker run -p 5001:9999 -v $PWD/myapp:/usr/src/myapp -w /usr/src/myapp julienstroheker/pythonflask python abc.py
docker ps -a
docker ps -l
docker ps
mkdir /dockerfile
vi dockerfile
FROM python:3.5
ADD . /dockerfile
WORKDIR /dockerfile
RUN pip install -r requirements.txt
RUN python abc.py
vi requirements.txt
flask
redis
docker build -t python_re .
docker images
docker tag python_re sumourn/python_re
docker push sumourn/python_re