Docker 系列之 Ubuntu 实战

介绍

在本片文章中,我们将尝试在 Docker 环境下安装和使用 Ubuntu 18.04。

操作

# 拉取 18.04 版本的 Ubuntu 镜像
docker pull ubuntu:latest

# 以交互方式运行并进入 ubuntu 容器环境
docker run -it --name my-ubuntu -p 80:80 ubuntu:latest /bin/bash

# 退出 ubuntu 容器环境 的交互模式
exit

# 创建待提交的副本
docker commit -m "init" -a "hippieZhou" container_id hippiezhou/ubuntu:latest

# 查看本地创建的镜像,会出现一个镜像名称为 hippiezhou/ubuntu,Tag 为 dev 的镜像
docker images

# 运行我们创建的本地本地镜像
docker run -it --name helloworld -p 80:80 hippiezhou/ubuntu:latest bin/bash

# 创建 Tag
# docker tag ubuntu:18.04 hippiezhou/ubuntu:latest

# 将我们修改的进行推送到 DockerHub
docker login
docker push hippiezhou/ubuntu:latest

# 拉取我们自定义的镜像
docker pull hippiezhou/ubuntu:latest
docker run -it --name hello-world -p 80:80 hippiezhou/ubuntu:latest bin/bash

相关参考

猜你喜欢

转载自www.cnblogs.com/hippieZhou/p/10744684.html