Docker production Practice (vi)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.