docker容器化

安装 dnf 工具

[root@6320d2889f0f /]# yum -y install dnf

安装 Docker 所需驱动
[root@6320d2889f0f /]# yum install -y device-mapper-persistent-data lvm2

安装 Docker 的 Yum 源

[root@ceph117 ~]# dnf config-manager --add-repo=https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo


[root@ceph117 ~]# dnf list docker-ce
查看镜像仓库

[root@ceph117 ~]# ls -lhrt /etc/yum.repos.d/

安装 Docker

yum install -y docker-ce --nobest

查看 Docker 版本
[root@ceph117 ~]# docker version
 
启动 Docker
设置 Docker 开机启动,并启动 Docker 服务。
[root@ceph117 ~]#  systemctl start docker 
 
systemctl enable docker --now

使用 docker pull 指令,拉取 Nginx 镜像文件
docker pull nginx
查看下载的镜像列表信息
[root@ceph117 ~]# docker image ls
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    605c77e624dd   2 years ago   141MB

 
删除名称为 nginx 的镜像,默认不写 tag 信息,默认的 tag 为 latest
[root@ceph117 ~]# docker image rm nginx:latest
 
查看运行中的 Docker 容器
[root@ceph117 ~]#  docker ps
CONTAINER ID   IMAGE     COMMAND       CREATED       STATUS       PORTS     NAMES
4f9aad109352   centos    "/bin/bash"   2 hours ago   Up 2 hours             festive_ellis

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值