Docker安装目录
- 1.在Centos上安装
- 2、如果已安装过Docker, 需要移除老版本的Docker
- 3、添加Docker repository yum源
- 4、开启Docker
- 5、验证
1.在Centos上安装
linux内核版本依赖
kernel version >= 3.8
可以使用如下命令查看
uname -a | awk '{split($3, arr, "-"); print arr[1]}'
[root@docker ~]# uname -a | awk '{split($3, arr, "-"); print arr[1]}'
3.10.0
关闭防火墙关闭selinux
systemctl stop firewalld
getenfore 0
2、如果已安装过Docker, 需要移除老版本的Docker
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
3、添加Docker repository yum源
https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo 把链接粘贴到浏览器,即可下载到电脑,通过xshell安装yum install lrzsz -y 即可直接将文件拉取到linux中来,要把docker-ce.repo放到**/etc/yum.repos.d/**,目录下
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install epel-release -y
yum install container-selinux -y
yum makecache fast
yum install docker-ce docker-ce-cli containerd.io
4、开启Docker
systemctl enable docker
systemctl start docker
5、验证
[root@docker ~]# docker run helloworld
Unable to find image 'helloworld:latest' locally
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/