标签:inspect tps 运行 otp routes tar Docker CE source debug
1.虚拟机基本准备
配置虚拟机的网卡(我这里直接用dhcp进行获取,也可以手动修改配置文件)
docker1机器
# docker1 > /etc/hostname
# hostname docker1
# systemctl restart network
# cat /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=8dd73d63-2872-4e0a-bc3f-daa11a4917a5
DEVICE=eno16777736
ONBOOT=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
2.配置yum源
# wget -O /etc/yum.repos.d/ https://download.docker.com/linux/centos/docker-ce.repo
# vim /etc/yum.repos.d/aliyun.com
[aliyun]
name=aliyun
baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/
gpgcheck=0
enabled=1
# vim /etc/yum.repos.d/doer.repo
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=0 #选择信任,不做检查
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://download.docker.com/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-edge]
name=Docker CE Edge - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-edge-debuginfo]
name=Docker CE Edge - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-edge-source]
name=Docker CE Edge - Sources
baseurl=https://download.docker.com/linux/centos/7/source/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://download.docker.com/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://download.docker.com/linux/centos/7/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
# yum makecache
3.安装docker
yum -y install docker-ce
## 安装docker-ce的时候,可能会显示安装报错(报错信息下图1),缺少安装包,但是由于有些镜像里面没有,经过查找,下面是下载这个包的地址
wget ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7x/external_products/extras/x86_64/container-selinux-2.9-4.el7.noarch.rpm
下载完成后,继续安装
yum -y install container-selinux-2.9-4.el7.noarch.rpm
yum -y install docker-ce
systemctl start docker
ps -ef |grep docker #存在表示安装完成(如下图2)
图1
图2
完成上面的步骤表示docker已经安装完成,环境也已经部署好了,接下来介绍一下docker的简单命令
docker pull 镜像名 #下载镜像
docker push 镜像名 #上传镜像
docker images #查看镜像
docker search 镜像名 #查找镜像
docker save 镜像名:latest >镜像名.tar #导出镜像为tar包
docker load < 镜像名.tar #导入镜像
docker rmi 镜像名 #删除docker镜像
docker run -it 镜像名 #用docker启动镜像(通过默认的标签latest启动,当修改了镜像名和标签的时候,需要加上新的标签 docker run -it 新镜像名:新标签)
exit #退出docker镜像
镜像常用命令
docker run -d nginx #启动nginx镜像
docker ps #查看后台运行的容器
docker ps -q #只显示容器ID
docker ps -a #显示所有容器
docker ps -aq #显示所有的容器ID
docker history centos #查看centos镜像历史(制作过程)
docker rmi 镜像名 #删除镜像,容器启动时,删除镜像会失败。要管关闭容器,在删除镜像
docker tage 镜像名:标签 新镜像名:新标签 #修改镜像的名称和标签,默认标签为latest
docker inspect centos #查看镜像的底层信息
容器命令
docker stop 容器ID #关闭容器
docker start 容器ID #启动容器
docker restart 容器ID #重启容器
docker rm 容器ID #容器运行中删除不了,需要先关闭容器
标签:inspect tps 运行 otp routes tar Docker CE source debug
原文地址:https://www.cnblogs.com/moniter/p/12305136.html