CentOS7 docker服务部署
以下命令可以在root身份下保存为shell脚本直接bash一次性执行
参考:
https://yeasy.gitbooks.io/docker_practice/install/centos.html
https://docs.docker.com/install/linux/docker-ce/centos/
http://www.ruanyifeng.com/blog/2018/02/docker-tutorial.html
#以下所有操作需以root身份执行 #去除本系统中所有可能的无效依赖 yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine #安装依赖 yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 #在中国国内的话设置docker源为中国科技大学镜像 yum-config-manager \ --add-repo \ https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo #更新yum缓存 yum makecache fast #安装docker-ce(社区版) yum install docker-ce #启动服务 systemctl enable docker systemctl start docker #建立docker用户组(组名可自定义) groupadd docker-tz #以root身份将一个普通帐户加入新的用户组(切勿将root用户加入组) usermod -aG docker-tz tuzhuo #以root身份运行测试程序 docker run hello-world # 若能输出以下信息则本系统docker服务部署成功 # Unable to find image 'hello-world:latest' locally # latest: Pulling from library/hello-world # d1725b59e92d: Pull complete # Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788 # 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. # (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/
tz@croplab,hzau
2019/9/28