Docker
来源:互联网 发布:冒险岛2mac能玩吗 编辑:程序博客网 时间:2024/06/06 09:18
1-确认系统信息
# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) # uname -aLinux CentOS-7 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
2-安装docker
# yum -y install docker
3-关闭SELinux和启动docker服务
关闭SELinux
- 永久方法:修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启。
临时方法:执行
setenforce 0
命令设置SELinux成为permissive模式sudo systemctl status firewalld.servicesudo systemctl stop firewalld.service sudo systemctl disable firewalld.service
启动docker服务[root@CentOS-7 ~]# systemctl start docker.service
设置自启动docker服务
[root@CentOS-7 ~]# systemctl enable docker.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.[root@CentOS-7 ~]# systemctl is-enabled docker.serviceenabled[root@CentOS-7 ~]#
4-设置docker代理
# vim /etc/sysconfig/docker
添加如下内容
HTTP_PROXY=http://10.144.1.10:8080
HTTPS_PROXY=https://10.144.1.10:8080
FTP_PROXY=ftp://10.144.1.10:8080
5-重启docker
# systemctl daemon-reload
# systemctl restart docker
6-安装验证
运行官方镜像hello-world文件
# docker run hello-worldUnable to find image 'hello-world:latest' locallyTrying to pull repository docker.io/library/hello-world ... latest: Pulling from docker.io/library/hello-worldc04b14da8d14: Pull complete Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9Status: Downloaded newer image for docker.io/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/# # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdocker.io/hello-world latest c54a2cc56cbb 5 months ago 1.848 kB
另外一种Docker代理设置方法:
修改docker.service文件# vim /usr/lib/systemd/system/docker.service
在[Service]部分添加如下内容
Environment="HTTP_PROXY=http://10.144.1.10:8080"
Environment="HTTPS_PROXY=https://10.144.1.10:8080"
Environment="FTP_PROXY=ftp://10.144.1.10:8080"
或者,另外创建代理文件
# mkdir /etc/systemd/system/docker.service.d# touch /etc/systemd/system/docker.service.d/proxy.conf# vim /etc/systemd/system/docker.service.d/proxy.conf
增加以下内容
[Service]
Environment="HTTP_PROXY=http://10.144.1.10:8080"
Environment="HTTPS_PROXY=https://10.144.1.10:8080"
Environment="FTP_PROXY=ftp://10.144.1.10:8080"
重启docker# systemctl daemon-reload
# systemctl restart docker
检查docker环境变量是否加载
# systemctl show docker --property EnvironmentEnvironment=GOTRACEBACK=crash HTTP_PROXY=http://10.144.1.10:8080 HTTPS_PROXY=https://10.144.1.10:8080 FTP_PROXY=ftp://10.144.1.10:8080
- docker
- docker
- docker
- docker
- Docker
- Docker
- docker
- Docker
- Docker
- Docker
- Docker
- docker
- Docker
- Docker
- docker
- Docker
- Docker
- Docker
- 51Nod 数字0到9的数量 (数位DP)
- 读书笔记--SQL必知必会01--了解SQL
- c#基于socket编程实现简单多人聊天程序
- 读书笔记--SQL必知必会02--检索数据
- 读书笔记--SQL必知必会03--排序检索数据
- Docker
- 专业课程设计之客户与服务器程序的同步与通信机制的设计(四)信号量
- logistic回归算法原理及python实现
- 读书笔记--SQL必知必会04--过滤数据
- 读书笔记--SQL必知必会05--高级数据过滤
- 人工“碳”索意犹尽,智能“硅”来未可知(深度学习入门系列之二)
- 数据结构与算法题目汇总
- Testing
- Struts2之方法拦截器