基于centos的docker安装
2016-07-21 14:38
776 查看
1. 安装需求
内核版本3.10以上
Centos 7以上
64位版本
2. 使用root登录或者具有sudo权限
3. 确保系统是最新的
4. 添加yum源
5. 安装docker包
6. 开启docker服务
7. 验证安装
输出如下
内核版本3.10以上
Centos 7以上
64位版本
2. 使用root登录或者具有sudo权限
3. 确保系统是最新的
yum update
4. 添加yum源
tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
5. 安装docker包
yum install docker-engine
6. 开启docker服务
service docker start
7. 验证安装
docker run hello-world
输出如下
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world c04b14da8d14: Pull complete Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9 Status: Downloaded newer image for hello-world:latest 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. 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 Hub account: https://hub.docker.com For more examples and ideas, visit: https://docs.docker.com/engine/userguide/[/code]
8. 创建docker组(可选)
docker命令必须root权限执行,但docker用户组默认拥有这个权限groupadd docker usermod -aG docker your_username
docker组的用户默认可执行docker命令,无需root权限
9. 启动时运行docker服务(可选)chkconfig docker on
10. 卸载docker
查看安装docker包$ yum list installed | grep docker docker-engine.x86_64 1.11.2-1.el7.centos @dockerrepo docker-engine-selinux.noarch 1.11.2-1.el7.centos @dockerrepo
删除安装的包yum -y remove docker-engine.x86_64
这一步并未删除数据,要想删除镜像、容器和磁盘卷,执行如下命令rm -rf /var/lib/docker
相关文章推荐
- 在docker环境中制作openstack镜像文件
- 多种方式(含docker容器)实现零停机时间(Zero-Downtime)部署
- 深入理解docker graph driver - DeviceMapper
- 用Docker配置简单的Nginx+Apache的web负载均衡
- docker的ubuntu安装
- kubernetes+docker监控之简介
- marathon部署docker很方便,阶段性学习成果
- 论docker中 CMD 与 ENTRYPOINT 的区别
- docker – 你应该知道的10件事
- docker – 你应该知道的10件事
- docker – 你应该知道的10件事
- docker4dotnet #2 容器化主机
- docker4dotnet #2 容器化主机
- docker4dotnet #2 容器化主机
- docker安装配置
- Kubernetes Cluster Installation Manual
- Docker – 你应该知道的10件事
- Swarm负责人谈Docker Swarm的架构、现状和未来
- Docker 容器逃逸案例分析
- Docker到底是什么?为什么它这么火!