李明
|
(一)什么是docker hub
vagrant 安装docker
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.require_version ">= 1.6.0" boxes = [ { :name => "docker-vagrant-centos", :mem => "2048", :cpu => "2" } ] Vagrant.configure(2) do |config| config.vm.box = "centos/7" boxes.each do |opts| config.vm.define opts[:name] do |config| config.vm.hostname = opts[:name] config.vm.provider "vmware_fusion" do |v| v.vmx["memsize"] = opts[:mem] v.vmx["numvcpus"] = opts[:cpu] end config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--memory", opts[:mem]] v.customize ["modifyvm", :id, "--cpus", opts[:cpu]] end config.vm.network :private_network, auto_config: true, ip: "192.168.70.100", bridge:"ens1f0", bootproto: "static", gateway: "192.168.70.1" end end config.vm.provision "shell", privileged: true, path: "./setup.sh" end
#/bin/sh sudo yum install -y yum upgrade yum-utils device-mapper-persistent-data wget sudo yum install -y net-tools sudo yum install -y curl policycoreutils openssh-server openssh-clients sudo systemctl enable sshd sudo systemctl start sshd sudo yum install -y postfix sudo systemctl enable postfix sudo systemctl start postfix sudo firewall-cmd --permanent --add-service=http sudo systemctl reload firewalld sudo curl -sSL https://get.docker.com/ | sh sudo curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://b81aace9.m.daocloud.io sudo systemctl restart docker sudo yum -y install epel-release sudo yum -y install python-pip sudo yum clean all sudo pip install docker-compose
vagrant up
(1). 虚拟机vagrant讲述安装的步骤 vagrant up (2).机器window/mac开通远程登录root用户下 su - # 密码 vagrant #设置 PasswordAuthentication yes vi /etc/ssh/sshd_config sudo systemctl restart sshd
docker login
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io sudo systemctl restart docker
#默认下载最后一个版本 docker pull centos docker images
PS:说了下docker的优越性,vagrant的方式搭建了一个centos7的docker环境。一定要了解集装箱的概念对了解docker很有必要。 >>原创文章,欢迎转载。转载请注明:转载自 IT人故事会 ,谢谢! >>原文链接地址: 「docker实战篇」python的docker-docker系统管理-基础概念(28) |
2019-06-27 09:58:56