docker 搭建nagios

  1. 安装docker

yum –y install docker

  1. 系统准备

net.ipv4.ip_forward = 1

3、关闭selinux
    getenforce命令查看selinux状态
    修改selinux状态  :
vi /etc/sysconfig/selinux

把里边的一行改为

SELINUX=disabled

改了之后保存,然后重启就可以了

二、下载镜像
[root@docker1 docker]# docker pull centos
查看镜像:Shell># docker images

REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE

local/myapp             d1206               a9612d9528b8        4 seconds ago       196.5 MB

基于容器生成镜像:

Shell>#docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

docker commit myapp local/myapp:d1206

验证

Shell># docker images

REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE

local/myapp             d1206               a9612d9528b8        4 seconds ago       196.5 MB

 

导入本地模板

功能:将压缩包的的数据导入的docker中,这个压缩文件可以是docker save 导出的镜像压缩包,也可以是docker export 导出的容器压缩包。

Shell># docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]

 

参数

说明

备注

-c, --change=[]

Apply Dockerfile instruction to the created image

 

-m, --message

Set commit message for imported image

 

 

Shell># docker import myapp.tar local/myapp:cs

验证

Shell>#  docker images

REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE

local/myapp             cs                  760a6a3e524e        5 seconds ago       203.3 MB

修改镜像tag

语法:

Shell>#docker tag IMAGE[:TAG] IMAGE[:TAG]

示例:

Shell># docker tag local/myapp docker.io/myapp

保存镜像

Shell># docker save [OPTIONS] IMAGE [IMAGE...]

将容器保存为tar压缩包

参数

说明

备注

-c, --change=[]

Apply Dockerfile instruction to the created image

 

-m, --message

Set commit message for imported image

 

 

示例

我们将“local/myapp” tag为“apache”的数据包保存到myapp.tar

Shell># docker save local/myapp:apache > ~/myapp.tar

装载镜像备份

这个部分有两个命令可以实现,命令如下

  1. docker load
  2. docker import

 

说明

 

 

Shell># docker load [OPTIONS]

从压缩包或者标准输入中加载镜像

参数

说明

备注

-i, --input string

Read from tar archive file, instead of STDIN

 

-q, --quiet

Suppress the load output

 

--help

打印帮助信息

 

 

示例:

Shell># docker load -i myapp.tar

也可以使用如下方式

Shell># cat myapp.tar | docker load

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值