cat /etc/sysconfig/docker
other_args=‘-g /rc/local/docker‘
OPTIONS
=
‘
--selinux-enabled --log-driver=journald -g /rc/docker‘
INSECURE_REGISTRY
=
‘
--insecure-registry registry.docker.com‘
ADD_REGISTRY
=
‘
--add-registry registry.docker.com‘
#Dockerfile
FROM library/centos:7
RUN yum install -y libcurl-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 libxslt-devel.x86_64 gcc gcc-c++ python-setuptools.noarch python-devel.x86_64 net-tools.x86_64 telnet.x86_64
RUN easy_install -i http://mirrors.aliyun.com/pypi/simple pip
RUN pip install setuptools --upgrade
RUN pip install -i http://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com -r /rc/local/api/requirements.txt
RUN useradd test
RUN mkdir /rc/{conf,data,lib,local,log,run,share};mkdir /rc/conf/ssl
ADD workplace/ /rc/local/api/
ADD my.cnf /etc/
ENV PYTHON_EGG_CACHE /rc/.python-eggs
ENV PYTHONPATH /rc/local/api/Source
ENV INSTANT_HOME /rc
WORKDIR /rc/local/api
CMD ["python", "/rc/local/api/Source/Forge/AppService/AppService.py","-p","8700"]
#生成环境镜像devops_env/onduty_api_env:v0.1
docker build -t devops_onduty_env:v0.1 .
dcoker tag devops_onduty_env:v0.1 devops_env/onduty_api_env:v0.1
docker push devops_env/onduty_api_env:v0.1
#### 提权和/usr/sbin/init 才可以使用systemctl
docker run -itd --privileged -p 3306:3306 --name mysql mariadb:v0.1 /usr/sbin/init