CentOS装docker

参考: https://docs.docker.com/engine/install/
1.卸载旧版
yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
2.配置yum阿里镜像
yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3.安装yum-utils
yum install -y yum-utils

4.查看可用版本

[root@centos1 ~]# yum list docker-ce --showduplicates | sort -r|head
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
已加载插件:fastestmirror, langpacks
已安装的软件包
可安装的软件包
 * updates: mirrors.aliyun.com
Loading mirror speeds from cached hostfile
 * extras: mirrors.aliyun.com
 * epel: mirror.lzu.edu.cn
docker-ce.x86_64            3:20.10.2-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.1-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.1-3.el7                    @docker-ce-stable
[root@centos1 ~]#

4.指定版本安装

yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

4.安装
yum install docker-ce docker-ce-cli containerd.io
【说明:
If prompted to accept the GPG key, verify that the fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it.
Docker is installed but not started. The docker group is created, but no users are added to the group.】
5.启动Docker
service docker start 或 systemctl start docker
停止 service docker stop 或 systemctl stop docker
重启  service docker restart 或 systemctl restart  docker
6.运行hello-world
docker run hello-world
7.查版本
docker version
8.docker默认安装目录
/var/lib/docker

9.

docker容器向本机传送文件
docker cp container_id:docker容器内的文件全路径 本机保存文件的全路径
例如:docker cp 4a2f08d2c1f8:/data1/configure.txt E:\PHP\configure.txt

本机向docker容器传送文件
docker cp 本机保存文件的全路径 container_id:docker容器内的文件全路径
例如:docker cp E:\PHP\configure.txt 4a2f08d2c1f8:/data1/configure.txt

猜你喜欢

转载自blog.csdn.net/mnbwz/article/details/111300419