Skip to content

Latest commit

 

History

History

module3

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

3.1 构建本地镜像

docker build -t kithung/cncamp/http-server:v1 .

``

3.2 编写 Dockerfile 将模块二作业编写的 httpserver 容器化

  • 分阶段构建
  • 一个编译、一个运行

3.3 将镜像推送至 docker 官方镜像仓库

docker push kithung/cncamp/http-server:v1

3.4 通过 docker 命令本地启动 httpserver

docker run -d kithung/cncamp/http-server:v1

3.5 通过 nsenter 进入容器查看 IP 配置

docker inspect -f '{{.State.Pid}}' ${container_id}

nsenter -t ${pid} -n ip addr