LuoSong
LuoSong
Published on 2024-01-13 / 50 Visits
0
0

Docker安装

Docker安装

Ubuntu22.04

安装====
apt-get update
apt-get install ca-certificates curl gnupg lsb-release #必要软件
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg #安装证书
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io #安装Docker
docker version #成功后弹出版本号等信息
卸载====
apt-get remove docker docker-engine docker.io containerd runc #移除旧版本
rm -rf /var/lib/docker
rm -rf /var/lib/containerd
操作====
docker pull [image]:[TAG] #拉取对应版本镜像,不填TAG默认:[latest]
docker images #查看所有镜像
docker ps -a #查看所有容器服务
docker rmi (-f) [image]:[TAG] #(强制)删除对应镜像
docker rm (-f) [container] #(强制)删除容器服务

CentOS7

yum -y install gcc
yum -y install gcc-c++
yum install -y yum-utils
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
docker -v
卸载====
yum remove docker 
              docker-client 
              docker-client-latest 
              docker-common 
              docker-latest 
              docker-latest-logrotate 
              docker-logrotate 
              docker-selinux 
              docker-engine-selinux 
              docker-engine 
              docker-ce
              
docker-compose
下载对应的包
https://github.com/docker/compose/releases/download/v2.24.0/docker-compose-linux-aarch64
移动到
/usr/local/bin
添加可执行权限
chmod +x /usr/local/bin/docker-compose
docker-compose -v

Comment