1. docker安装
1.1 关闭防火墙
# systemctl stopfirewalld
# systemctl disablefirewalld
1.2 SELINUX 配置
编辑文件/etc/selinux/config ,设置
SELINUX=DISABLED
然后运行命令
# setenforce 0
重启服务器
# reboot
1.3 开始安装
更新现有包
yum update
执行docker安装脚本
curl -sSLhttps://get.docker.com/ | sh
启动docker服务
systemctl start docker
确认docker安装成功
docker run hello-world
Unable to find image'hello-world:latest' locally
latest: Pulling fromhello-world
a8219747be10: Pullcomplete 91c95931e552: Already exists
hello-world:latest: Theimage you are pulling has been verified. Important: image verification is atech preview feature and should not be relied on to provide security. Digest:sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d
Status: Downloaded newerimage for hello-world:latest
Hello from Docker.
This message shows thatyour installation appears to be working correctly.
To generate thismessage, Docker took the following steps:
1. The Docker clientcontacted the Docker daemon.
2. The Docker daemonpulled the "hello-world" image from the Docker Hub.
(Assuming it was notalready locally available.)
3. The Docker daemoncreated a new container from that image which runs the executable that producesthe output you are currently reading. 4. The Docker daemon streamed that outputto the Docker client, which sent it to your terminal.
To try something moreambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
For more examples andideas, visit: http://docs.docker.com/userguide/
2. 了解docker的镜像和容器
在上一步中,运行了
docker run hello-world
执行这一个命令,你完成了使用docker的核心任务。
你运行的命令分为三个部分。
一个容器是