Installation and use of Docker containers in Linux systems

Source: Internet
Author: User
Tags docker cp docker hub docker run aliyun

Introduction to Docker creating background
项目的开发环境和部署环境不一致,部署环境配置难度大。集群技术的发展,集群的相同配置操作难度大。
Basic concept
使用Go语言实现的云开源项目,"一次编译,处处运行",只需要一次配置环境,就可以在其他环境一键部署,软件即容器,虚拟化。
Virtualization Technology
虚拟机:一种带环境安装的解决方案,模拟整套操作系统,笨重。容器:将所有运行环境打包成互相隔离的容器,不进行硬件虚拟。
Development/Operations (DEVOPS)
开发自运维、一次开发,处处运维。
Official information

Docker
Docker Chinese
Docker Hub

Environmental Installation System Requirements
    1. CentOS 7(64位)    2. CentOS6.5(64位)及以上    3. 系统内核版本为2.6.32-431以上
Basic structure

    1. Image: A read-only template in which one image can create multiple containers.
    2. Container (Container): Run one or more applications, Lite Linux.
    3. Warehouses (repository): Centrally store images, private libraries, public libraries.
Installation Method CentOS 6.8 Installation
    1. yum install -y epel-release
    2. yum install -y docker-io
    3. vi /etc/sysconfig/docker
    4. service docker start
    5. 验证安装
CentOS 7 Installation
1. yum install -y yum-utils    device-mapper-persistent-data    lvm22. yum-config-manager --add-repo \    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo3. yum-config-manager --enable docker-ce-edge4. yum-config-manager --enable docker-ce-test5. yum-config-manager --disable docker-ce-edge6. yum install docker-ce#安装特定版本7. yum list docker-ce --showduplicates | sort -r   yum install docker-ce-<VERSION STRING>8. systemctl start docker   #开启#测试 会自动跑一个hello 容器docker run hello-world   #####以上是官方给出的方法############################################实际我第一次安装只用到了下面的命令##############下载一个repo 到repo的文件夹中wget https://mirrors.aliyun.com/dockerce/linux/centos/docker-ce.repo#使用yum 命令安装docker-ce 也就是docker 社区版yum install docker-ce -y
Hello World Ari like a warehouse
sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-‘EOF‘{  "registry-mirrors": ["https://l608quqb.mirror.aliyuncs.com"]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker#开机自动启动sudo systemctl enable docker
Run Hello World: docker run hello-worldOperating principle
C/S结构,应用程序及其环境运行在容器中,比虚拟机有更少的抽象层,利用宿主内核,不虚拟硬件,不虚拟新的容器运行环境,利用宿主启动速度快。
Common commands Help commands
docker versiondocker infodocker help
Mirroring command
docker imgages  [-a][-q]            docker search [-s]docker pulldocker rmi -f [name:version][ID]docker rmi -f $(docker -q)  删去全部
Container command
#启动方式docker run -i -t centos         进入了CentOS-d:以后台运行容器,返回容器ID,守护式容器-i:以交互模式运行容器-t:为容器重新分配终端-P:随机端口映射-p:指定端口映射    ip:hostPort:containerPort    ip::containerPort    hostPort:containerPort    containerPort    #查看容器使用历史docker ps -a:运行中+历史-l:最近创建-n:最近n个-q:静默模式--no-trunc:不截断输出宿主bash:exit:退出并关闭         ctrl+p+q:返回主机#返回容器docker attach [id] 返回容器#停止容器docker restart/stop [name][id]docker kill [name][id]#删除容器docker rm -f $(docker -a -q)        删除容器dockeer -a -q |xargs docker rm -f   批量删除容器docker logdocker top [id]docker inspect [id]docker cp [id]####################docker run -itd [id]:uri uri
Mirrored federated File System (UnionFS)
一种分层、轻量级并且高性能的文件系统,支持对文件系统的修改作为一次提交来一层层低价,可以将不同目录挂在到同一个虚拟文件系统下。
Mirror Loading principle
bootfs(boot file system):包含Bootloader和Kernel,镜像最底层为bootfs,加载完成后,内核导入内存,内存使用权转交给内核,卸载bootfs。rootfs(root file system):包含/dev、/bin、/et等标准目录和文件。

Docker container installation and use in Linux systems

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.