centos 安装 docker
来源:互联网 发布:中国大数据规划图 编辑:程序博客网 时间:2024/06/05 12:14
centos 安装 docker
https://docs.docker.com/engine/installation/linux/centos/
前期准备:需要64位操作系统,3.10版本以上内核。
$ uname -r3.10.0-229.el7.x86_64
安装docker 引擎
通过 yum 安装
- 通过 root 登录
- 系统更新
$ sudo yum update - 添加 repo 源
$ sudo 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 - 安装 docker 包
$ sudo yum install docker-engine - 启用服务
$ sudo systemctl enable docker.service - 启动守护进程
$ sudo systemctl start docker 测试是否安装成功
$ sudo docker run --rm hello-worldUnable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-worldc04b14da8d14: Pull completeDigest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9Status: Downloaded newer image for hello-world:latestHello 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 bashShare images, automate workflows, and more with a free Docker Hub account:https://hub.docker.comFor more examples and ideas, visit:https://docs.docker.com/engine/userguide/
使用脚本安装
- 通过 root 登录
系统更新
$ sudo yum update
运行docker 安装脚本
$ curl -fsSL https://get.docker.com/ | sh
启用服务
$ sudo systemctl enable docker.service
启动守护进程
$ sudo systemctl start docker
测试是否安装成功
$ sudo docker run --rm hello-world
创建 docker 组
为了启动 daemon 而不使用root
- root 权限
创建 docker 组
$ sudo groupadd dockergroupadd:“docker”组已存在
在 docker组添加用户
此处先使用 useradd 、passwd 添加用户,设置密码$ sudo usermod -aG docker your_username
退出并且登录到your_username,如果在your_username下也建议退出再重新登录一次,这确保您的用户正在运行正确的权限。
- 验证运行docker已不再需要sudo命令
$ docker run --rm hello-world
开机启动 docker daemon
$ sudo systemctl enable docker
删除 docker (使用yum)
列出已安装的 docker 包
$ yum list installed | grep dockerdocker-engine.x86_64 1.12.3-1.el7.centos @dockerrepodocker-engine-selinux.noarch 1.12.3-1.el7.centos @dockerrepo
删除上面的包
$ sudo yum -y remove docker-engine.x86_64$ sudo yum -y remove docker-engine-selinux.noarch*This command does not remove images, containers, volumes, or user-created configuration files on your host.*
remove images, containers, volumes
$ rm -rf /var/lib/docker
Locate and delete any user-created configuration files.
0 1
- docker-centos安装docker
- Docker----CentOS Docker 安装
- CentOs安装Docker,docker machine
- <docker系列> centos 安装docker
- centos 安装 docker docker-compose
- CENTOS:Docker安装centos容器
- ubuntu centos 安装docker
- centos 7安装docker
- CentOS安装Docker
- Centos 7 安装 docker
- Centos 7安装Docker
- CentOS 7安装Docker
- centos安装Docker
- CentOS安装Docker
- CentOS上安装Docker
- CentOS 6.5 Docker安装
- CentOS 6.7安装docker
- centos 6.5 安装docker
- 数据库村的旺财和小强
- 求两个文件的相对路径
- Android 混淆从入门到精通
- Can't allocate space for object 'syslogs' in database:Sybase
- 树莓派更改默认GB按键
- centos 安装 docker
- Spring的IOC原理
- Java I/O底层是如何工作的?
- Android学习 (二十四) 实现ListView跳转到对应页面的ViewPager
- win101如何禁止开机自启动程序
- mysql常用函数整理
- iOS 持续集成系列 - 自动化 Code Review
- CPU利用率的计算
- 使用jdom将String类型的xml字符串转成xml