This article is mainly about how to use Dockerfile to build the image of the LNMP environment, provided that you have installed Docker one, new Dockerfile file .
From ubuntu:16.04
maintainer turtle "turtle@anasit.com"
RUN \
apt-key adv--keyserver hkp:// keyserver.ubuntu.com:80--recv 0xcbcb082a1bb943db \
apt-get update \
apt-get install-y Mariadb-server Mariadb-common \
As we all know, if the outside to communicate with the Docker container, in addition to the link must be a port mapping, the following first describes the use of the Dockerfile expose, and then do a multi-port random mapping example bar.
The format is:EXPOSE PORT
Here's my dockerfile.
# Tomcat
# Version 0.0.1
# get_image from
192.168.0.216:5000/centos
# maintainer_info
Maintainer Hongxue hongxue@showjo
1. The base image of this image is: https://www.cnblogs.com/JoeyWong/p/9173265.html2. Put the packaged project files in a directory similar to Dockerfile3, Dockerfile as follows:# Base OS image fromCentos:jdk8MaintainerJoey LABELDescription= "This image is Javaweb images." Version= "1.0"#java WebRUNmkdir/home/data# uploading project files locally to the mirrorADDjavaweb-package.zip/home/data# unzip the project and delete the extra files after decompre
from Ubuntu:14.10maintainer linx# adds Java and Tomcat to the container, and add extracts the add JDK -8u1 51-linux-x64.tar.gz/usr/local/add Apache -tomcat-8.0.47.tar.gz/usr/local/ #将项目复制到webapps目录下, copy is to not press the copy Exam.war /usr/local/ Apache-tomcat-8.0.47/webapps #配置java与tomcat环境变量ENV java_home /usr/local/ Jdk1.8.0_151env CLASSPATH $JAVA _home /lib/dt.jar: $JAVA _home/lib/tools.jarenv catalina_home /usr/local/apache-tomcat-8.0.47env catalina_base /usr/local/apache-tomcat-8.0
Objective
When you use the Docker build to make your own image, you use the Run command to perform some operations to install some of the necessary software.
And some software installation process will require users to enter yes/no or y/n to determine something before entering the next installation.
This can be solved in dockerfile. if it's an occasion to install with Yum,
RUN Yum install-y xxx
The-y parameter can skip the software query, which i
Dockerfile content is as follows:
From ubuntu:14.04
#刷新包缓存 and install wget tools
RUN apt-get update apt-get install-y wget
#设置工作目录
Workdir/home
# Install JDK
RUN wget--no-cookies--no-check-certificate--header "cookie:gpw_e24=http%3a%2f% 2fwww.oracle.com%2ftechnetwork%2fjava%2fjavase%2fdownloads%2fjdk7-downloads-1880260.html;oraclelicense= Accept-securebackup-cookie "Http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
RU
Mirror capture[Root@docker-node01 ~]# Docker Search Shadowsocksr_manyuserNAME DESCRIPTION Stars Official automatedBenyoo/shadowsocksr_manyuser based on SHADOWSOCKSR version of Manyuser package 0[Root@docker-node01 ~]# docker run-d--name=shadowsocks \
(1) The first instruction format from the:D ockfile: from image or from Image:tag(2) Maintainer: Maintenance personnel information(3) Run: Execute instruction in the form of Run command or run ["Executable", "param1", "param2"]Run command
three forms of cmd: cmd ["Executable", "param1", "param2"] (exec form, preferred format) cmd ["param1", "param2"] (as the default parameter of entrypoint) cmd command param1 par AM2 (shell form)
Note: the above exec form will be parsed into a JSON
almost essential to learn to write Dockerfile, which helps you understand the operation of the entire container.FROM: Creates a new image FROM a basic image.
FROM ubuntu MAINTAINER, MAINTAINER Information
MAINTAINER William ENV, set Environment Variables
ENV TEST 1RUN, non-interactive RUN shell command
RUN apt-get -y update RUN apt-get -y install nginxADD: copy an external file to the image. src can be a u
versions
root@devstack:/home/sammy# Docker--version
Docker version 1.12.1, build 23cf638
Start the first container:
Start the first Docker container Docker run Hello-world
root@devstack:/home/sammy# Docker run Hello-world
Hello from docker!
This message shows the your installation appears to be working correctly.
The success of its operation also indicates that the previous installation steps are running correctly.
Refer to the above content from Docker official we
This series of articles will introduce Docker knowledge:
(1) Docker installation and basic usage
(2) Docker mirror
(3) Isolation of Docker containers-use Linux namespace isolate container's operating environment
(4) Isolation of Docker containers-use cgroups to limit the resources used by the container
(5) Docker Network
1. Installation
1.1 Installing Docker on Ubuntu 14.04
Prerequisite Requirements:
Kernel version must be 3.10 or above
Foll
Basic concepts:
Container
Container. Each container can be viewed as a standalone host. The creation of container usually has an image as its template. Analogy to a virtual machine can be understood as image is the mirror of the virtual machine, and container is a running virtual machine. A virtual machine image can create multiple running virtual hosts and be independent of each other. Note: Once created, container will persist if not r
Use the dockerfile MethodPreparations# Mkdir sshd_ubuntu create a working directory# Cd sshd_ubuntu# Touch dockerfile run. Sh the file to be copied to the container after being created# Vi run. Sh run. SH Content#! /Bin/bash/Usr/sbin/sshd-d# Cat ~ /. Ssh/id_rsa.pub> authorized_keys copy the public key that needs to be logged on to the container MachineWrite dockerfile
Common commands can be divided into the following types1. Container life Cycle Management # Docker [Run|start|stop|restart|kill|rm|pause|unpause]2. Container Operation Ops # Docker [Ps|inspect|top|attach|events|logs|wait|export|port]3. Container rootfs Command # docker [Commit|cp|diff]4. Mirrored warehouse # docker [Login|pull|push|search]5. Local image Management # Docker [Images|rmi|tag|build|history|save|import]6. Other commands # Docker [Info|version]Image related Operations Command:There ar
Basic knowledge of notes in the basic python tutorial and basic python tutorial
Digit-related
Add from _ future _ import division to the Python program, directly execute it in the interpreter, or use the command switch-Qnew when running Python through the command line, the single slash will not be divisible, as shown in figure
>>> 1/20.5
The dual-slashes imple
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.