千家信息网

Docker 之 基本安装配置

发表于:2024-12-02 作者:千家信息网编辑
千家信息网最后更新 2024年12月02日,一、安装epel源yum install epel-release -y二、添加docker源yum install -y yum-utilsyum-config-manager --add-repo
千家信息网最后更新 2024年12月02日Docker 之 基本安装配置

一、安装epel源

yum install epel-release -y

二、添加docker源

yum install -y yum-utilsyum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

三、查看当前docer安装版本号

yum list docker-ce --show-duplicates

四、安装社区版docker

yum -y install docker-ce

五、创建配置docker的配置文件

docker]# vi /etc/docker/daemon.json {  "graph": "/data/docker",  "storage-driver": "overlay2",  "insecure-registries": ["registry.access.redhat.com","quay.io"],  "registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],  "bip": "172.7.5.1/24",  "exec-opts": ["native.cgroupdriver=systemd"],  "live-restore": true}graph: docker 工作目录sotrage-dirver: docer存储驱动模式insecure-registries:容器仓库registry-mirrors:仓库加速镜像bip:容器运行的网络exec-opts:容器的启动方式live-restore:当容器引擎中断时,所启动的容器继续运行

六、启动&关闭&重启docker

启动: systemctl start docker关闭: systemctl stop docker重启: systemctl restart docker

七、查看当前容器信息

[root@docker docker]# docker infoClient: Debug Mode: falseServer: Containers: 0  Running: 0  Paused: 0  Stopped: 0 Images: 0 Server Version: 19.03.5 Storage Driver: overlay2  Backing Filesystem: extfs  Supports d_type: true  Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: systemd Plugins:  Volume: local  Network: bridge host ipvlan macvlan null overlay  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 init version: fec3683 Security Options:  seccomp   Profile: default Kernel Version: 3.10.0-693.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 1.797GiB Name: docker ID: 2Q52:PFL3:RWZM:T77G:LAAB:NHX5:FWAL:4NDC:N6Q4:SNBU:BKRX:YWPW Docker Root Dir: /app/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries:  quay.io  registry.access.redhat.com  127.0.0.0/8 Registry Mirrors:  https://q2gr04ke.mirror.aliyuncs.com/ Live Restore Enabled: trueWARNING: bridge-nf-call-iptables is disabledWARNING: bridge-nf-call-ip6tables is disabled
0