Image Construction Ideas
Idea: Layered Design
The bottom: The system layer, to build their own application of different operating system image;
Middle Layer: Based on the operating environment, such as PHP, Java, Python, and so on, to build Business foundation environment layer Image;
Top-level: Build application service layer mirroring based on specific business modules.
Directory Building tree structure
Case 1: CentOS 7 System mirroring build
Cd/rootmkdir-p/root/docker/system/centoscd/root/docker/system/centoswget-o/etc/yum.repos.d/epel.repo/http Mirrors.aliyun.com/repo/epel-7.repo # Download Ali Rhel 7 Epel Source Cp/etc/yum.repos.d/epel.repo Epel.repo
Create image file
Vim dockerfile# This Dockerfile # Base imagefrom CentOS # whomaintainer Shhnwangjian [email protected] # Epeladd Epel.repo /etc/yum.repos.d/# Base pkgrun Yum install-y wget supervisor git tree net-tools sudo psmisc mysql-devel && yum C Lean All
Build image
Docker build-t Shhnwangjian/centos:base.
Case 2 : Build python run environment image based on Case 1 CentOS system Image
Mkdir-p/root/docker/runtime/pythoncd/root/docker/runtime/python
Create image file
Vim dockerfile# Base imagefrom shhnwangjian/centos:base# whomaintainer shhnwangjian [email protected]# Python EnvRUN Yum I Nstall-y python-devel python-pip supervisor# Upgrade piprun pip install--upgrade pip
Build image
Docker build-t Shhnwangjian/python.
Docker production Practice (vi)