
本文参考:https://zhuanlan.zhihu.com/p/23599229
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyundocker run hello-world

docker versiondocker search centosdocker pull centos,会拉取最新的版本docker images

docker run -it centos:latest /bin/bash-i 交互式,-t终端,-d 后台运行

git --version,没有就安装 yum install gitexit 退出容器,docker ps -a查看容器运行程序的情况docker commit -m "centos with git" -a "kobe24o" 父容器id kobe24o/centos:git

或者通过 配置文件来创建 vim dockerfile
# 说明该镜像以哪个镜像为基础
FROM centos:latest
# 构建者的基本信息
MAINTAINER kobe24o
# 在build这个镜像时执行的操作
RUN yum update
RUN yum install -y git
# 拷贝本地文件到镜像中
COPY ./* /usr/share/gitdir/输入命令docker build -t="kobe24o/centos:test" .
docker rm 容器iddocker rmi 镜像name 或者 id,如 docker rmi kobe24o/centos:testdocker login,输入用户名,密码
docker push kobe24o/centos:git


docker pull kobe24o/centos:git