LiuYuan's Blog
This is LiuYuan's Blog
Toggle navigation
LiuYuan's Blog
Home
Docker相关
MySQL相关
Ansible相关
维护脚本相关
Windows系统脚本
Python相关
Nginx相关
About Me
Archives
Tags
安装docker
2024-06-19 16:21:12
37
0
0
admin
#安装docker #!/bin/sh #关闭SeLinux sed -i 's/enforcing/disabled/g' /etc/sysconfig/selinux setenforce 0 #关闭防火墙 systemctl stop firewalld systemctl disable firewalld #安装docker 1,curl -fsSL https://get.docker.com/ | sh 2,yum install -y yum-utils yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo yum install docker-ce docker-ce-cli containerd.io #添加阿里DNS touch /etc/docker/daemon.json vi /etc/docker/daemon.json { "dns": ["223.5.5.5","223.6.6.6"] } #开启docker服务并开启开机自启动 systemctl start docker systemctl enable docker centos8 TencentOS https://blog.csdn.net/qq_31803267/article/details/122960656 #创建名为mynet的网络 docker network create mynet #安装docker-compose #(直接下载安装) curl -L https://get.daocloud.io/docker/compose/releases/download/v2.4.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose #(pip安装) 1、安装python-pip yum -y install epel-release yum -y install python-pip 2、安装docker-compose pip install docker-compose # centos8 使用以下命令安装 yum install epel-release python3-pip python3-devel pip3 install --upgrade pip pip3 install docker-compose 待安装完成后,执行查询版本的命令,即可安装docker-compose docker-compose version #查看docker容器运行状态 docker ps -a #进入docker容器 docker exec -it 容器ID/容器名 bin/bash docker exec -it 容器ID/容器名 bin/sh #复制宿主机文件到容器/复制文件到宿主机 docker cp 文件名 容器ID/容器名:/路径/文件名 docker cp 容器ID/容器名:/路径/文件名 /路径/文件名 #停止/删除 未启动的docker容器 docker ps -a|grep Exited|awk '{print $1}'|xargs docker stop docker ps -a|grep Exited|awk '{print $1}'|xargs docker rm #删除标签为none的镜像 docker images|grep none|awk '{print $3}'|xargs docker rmi #强制构建镜像并启动 docker-compose up -d --build --force-recreate #清理无用的docker容器及镜像文件 docker system prune
Pre:
nginx配置
Next:
apache node mysql安装
0
likes
37
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Footer
Table of content