安装linux虚拟机,在虚拟机上安装docker及镜像操作和容器操作

1、安装Docker
     1)、安装linux虚拟机
     1)、VMWare、VirtualBox(安装);
     2)、导入虚拟机文件centos7-atguigu.ova;
     3)、双击启动linux虚拟机;使用 root/ 123456登陆
    4)、使用客户端连接linux服务器进行命令操作;
    5)、设置虚拟机网络;
    桥接网络=选好网卡==接入网线;
    6)、设置好网络以后使用命令重启虚拟机的网络:service 1 network restart

    7)、查看linux的ip地址  ip addr

    8)、使用客户端连接linux;

  2)、在linux虚拟机上安装docker

           

    1、检查内核版本,必须是3.10及以上
    uname ‐r
    2、安装docker
    yum install docker
    3、输入y确认安装
    4、启动docker
    [root@localhost ~]# systemctl start docker
    [root@localhost ~]# docker ‐v
    Docker version 1.12.6, build 3e8e77d/1.12.6
    5、开机启动docker
    [root@localhost ~]# systemctl enable docker
    Created symlink from /etc/systemd/system/multi‐user.target.wants/docker.service to
    /usr/lib/systemd/system/docker.service.
    6、停止docker
    systemctl stop docker

systemctl start docker启动时候报错,需要打开编辑器修改配置文件

环境:centos7

命令:systemctl start docker

          systemctl status docker -l

报错:Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disable selinux in docker (--selinux-enabled=false)

解决方案:

意思是说:此linux的内核中的SELinux不支持 overlay2 graph driver ,解决方法有两个,要么启动一个新内核,要么就在docker里禁用selinux,--selinux-enabled=false

重新编辑docker配置文件:

用这个命令:vi /etc/sysconfig/docker
点击I打开编辑,--selinux-enabled=false然后esc退出,:wq就可以保存退出

 

3、Docker常用命令&操作

docker pull registry.docker-cn.com/library/xxx

https://hub.docker.com/

启动一个服务:systemctl start firewalld.service

 

关闭一个服务:systemctl stop firewalld.service

 

重启一个服务:systemctl restart firewalld.service

 

显示一个服务的状态:systemctl status firewalld.service

 

在开机时启用一个服务:systemctl enable firewalld.service

 

在开机时禁用一个服务:systemctl disable firewalld.service

 

查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?

 

查看已启动的服务列表:systemctl list-unit-files|grep enabled

 

 

切换国内镜像访问,然后重启

 

附上docker仓库网站https://hub.docker.com/

如果使用docker pull xxx来拉取镜像,那么会使用国外的网站,现在我们使用国内的镜像来拉取,会更快的下载,如下

docker pull registry.docker-cn.com/library/xxx                     --这个可以下载


下面的方式尝试无效果:

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://ef017c13.m.daocloud.io

 

  • 2
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值