vi Dockerfile
FROM hub.c.163.com/library/centos:7.4.1708
MAINTAINER <author@126.com>
LABEL version="centos:7.4.1708-tools" author="<author@126.com>"
RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
RUN yum install -y vim wget curl bzip2 unzip tcpdump bash-completion dos2unix psmisc
tcpdump less telnet net-tools lsof sysstat python-setuptools lrzsz ntpdate bind-utils
RUN ln -fs ../usr/share/zoneinfo/Asia/Shanghai /etc/localtime
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
封装镜像
docker build -t centos:7.4-tools .
使用下面命令可以查看上面定义的标签。
docker inspect -f "{{ .Config.Labels }}" centos:7.4-tools