docker-基础实战第三课

1,进入容器修改内容,下面是容器的一个结构图

2, 进入docker控制台  /bin/bash或者/bin/sh

docker exec -it 0362fa169399 /bin/bash

,3,查看nginx 首页index.html,通过修改这个首页html可以修改首页的静态内容

修改之前首页

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

 修改之后首页

echo "<h1>welcome to atguigu</h1>" > index.html

 4,提交改变

我们先退出docker容器内部exit

docker commit --help

 

Options:
  -a, --author string    Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
  -c, --change list      Apply Dockerfile instruction to the created image
  -m, --message string   Commit message
  -p, --pause            Pause container during commit (default true)
docker commit -a 'yuwenlong' -m '首页变化' 0362fa169399 wenlongNginx:v1.0
docker commit -a 'yuwenlong' -m '首页变化' 0362fa169399 wenlongnginx:v1.0

 使用了一个大写字母报了一个错:invalid reference format: repository name must be lowercase

 docker images可以看到我刚才提交的新镜像

 

 设置项没有设置名字,docker默认会给你生成一个名字

使用你提交镜像改变文件依然可以启动访问 ,这是一个重要的特性

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值