傳統(tǒng)的OS
1. install centos mini
2. virtualbox 虛機(jī)網(wǎng)橋配置:
修改網(wǎng)卡類型為網(wǎng)橋
vi /etc/sysconfig/network-script/ifcfg-enp0s3 ? add lines below:
HWADDR=08:00:27:2E:8B:3C
BOOTPROTO=static
IPADDR=192.168.0.9
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=8.8.8.8
DNS2=4.4.4.4
3. 更改主機(jī)名:
hostnamectl set-hostname k8s-centos-mini
4. install docker:
# yum update
# yum install docker
# systemctl enable docker.service
# systemctl start docker.service
5. 查看docker軟件包的構(gòu)成
# rpm -ql docker | more
/etc/docker
/etc/docker/certs.d
/etc/docker/certs.d/redhat.com
/etc/docker/certs.d/redhat.com/redhat-ca.crt
/etc/docker/certs.d/redhat.io
/etc/docker/certs.d/redhat.io/redhat-ca.crt
/etc/docker/certs.d/registry.access.redhat.com
/etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt
//...... Above, 使centos、redhat能使用REdhat自己的registry,而不僅是Docker Hub?Registry(https://registry.hub.docker.com / account:josiejiao)
// ? ? ? ?PS:對RHEL,docker軟件包還安裝了/usr/share/rhel/secrets 目錄,它們是關(guān)于訂閱管理文件,將被復(fù)制到容器中,所以容器無需消耗額外的訂閱
/etc/sysconfig/docker-network ? ?--> 用于收集傳給docker服務(wù)的網(wǎng)絡(luò)選項(xiàng)
/etc/sysconfig/docker-storage ? ?--> 用來改變Docker服務(wù)的存儲(chǔ)數(shù)據(jù)的方式的output設(shè)置, 默認(rèn)DOCKER_STORAGE_OPTIONS="--storage-driver overlay2 "
/etc/sysconfig/docker-storage-setup ?-->?--> 用來改變Docker服務(wù)的存儲(chǔ)數(shù)據(jù)的方式的input設(shè)置, ?默認(rèn)STORAGE_DRIVER=overlay2
// Docker的存儲(chǔ)后端可以定義多種:devicemapper, overlay, and overlay2
6. Docker command
? attach? ? ? Attach to a running container
? build? ? ? Build an image from a Dockerfile
? commit? ? ? Create a new image from a container's changes
? cp? ? ? ? ? Copy files/folders between a container and the local filesystem
? create? ? ? Create a new container
? diff? ? ? ? Inspect changes on a container's filesystem
? events? ? ? Get real time events from the server
? exec? ? ? ? Run a command in a running container
? export? ? ? Export a container's filesystem as a tar archive
? history? ? Show the history of an image
? images? ? ? List images
? import? ? ? Import the contents from a tarball to create a filesystem image
? info? ? ? ? Display system-wide information
? inspect? ? Return low-level information on Docker objects
? kill? ? ? ? Kill one or more running containers
? load? ? ? ? Load an image from a tar archive or STDIN
? login? ? ? Log in to a Docker registry
? logout? ? ? Log out from a Docker registry
? logs? ? ? ? Fetch the logs of a container
? pause? ? ? Pause all processes within one or more containers
? port? ? ? ? List port mappings or a specific mapping for the container
? ps? ? ? ? ? List containers
? pull? ? ? ? Pull an image or a repository from a registry
? push? ? ? ? Push an image or a repository to a registry
? rename? ? ? Rename a container
? restart? ? Restart one or more containers
? rm? ? ? ? ? Remove one or more containers
? rmi? ? ? ? Remove one or more images
? run? ? ? ? Run a command in a new container
? save? ? ? ? Save one or more images to a tar archive (streamed to STDOUT by default)
? search? ? ? Search the Docker Hub for images
? start? ? ? Start one or more stopped containers
? stats? ? ? Display a live stream of container(s) resource usage statistics
? stop? ? ? ? Stop one or more running containers
? tag? ? ? ? Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
? top? ? ? ? Display the running processes of a container
? unpause? ? Unpause all processes within one or more containers
? update? ? ? Update configuration of one or more containers
? version? ? Show the Docker version information
? wait? ? ? ? Block until one or more containers stop, then print their exit codes
----------------------------------
精簡的專為運(yùn)行容器的OS
Atomic類 ?基于rpm的linux發(fā)型版構(gòu)建器?
www.projectatomic.io/docs/quickstart
方案1. 云上部署 - qcow2格式的形式
Fedora:?https://alt.fedoraproject.org/cloud/, 有適用于opestack 的base cloud的qcow2
Centos https://buildlogs.centos.org/centos/7/isos/x86_64/?, 有適用于云端的qcow2?CentOS-7-x86_64-AtomicHost-20141129_02.qcow2,通過cloud-init注入配置信息
redhat: 適用于Red hat企業(yè)虛擬化平臺(tái)的qcow2
方案2. 通過宿主機(jī)的Vagrant(https://www.vagrantup.com),快速部署啟動(dòng)虛擬機(jī) - Vagrant box鏡像
Fedora:https://alt.fedoraproject.org/cloud/, 有適合windows的virtual box版,和Fedora的KVM版
Centos:??https://buildlogs.centos.org/centos/7/isos/x86_64/?
Redhat: 支持Hyper-V / Vmware的ova/vhd
方案3. 傳統(tǒng)ISO安裝方式
AtomicHost的維護(hù)
實(shí)際上,atomic Host上 rpm和yum工具都不能用了
替代 安裝: 添加普通容器 實(shí)現(xiàn)安裝應(yīng)用, 添加特權(quán)容器 實(shí)現(xiàn)宿主機(jī)系統(tǒng)訪問的工具安裝
替代 升級(jí): # atomic host upgrade
CoreOS類
https://coreos.com/os/docs/latest/booting-with-iso.html
方案1. live iso 安裝
fedora:??https://buildlogs.centos.org/centos/7/isos/x86_64/?