vim Dockerfile
#############################################################dckerfile to build mysql for mir container images# Based on Ubuntu# ############################################################FROM 172.16.101.192/common/mysql:5.6# File Author / MaintainerMAINTAINER huzhengbo#ADD mir_scalr.sql to container docker-entrypoint-initdb.dADD analytics.sql /docker-entrypoint-initdb.dADD scalr.sql /docker-entrypoint-initdb.dADD keycloak.sql /docker-entrypoint-initdb.dADD mirmon.sql /docker-entrypoint-initdb.dADD mir_scalr.sql /docker-entrypoint-initdb.dADD mir_pack.sql /docker-entrypoint-initdb.dADD oneaa.sql /docker-entrypoint-initdb.dADD one_log.sql /docker-entrypoint-initdb.d#the mysql portEXPOSE 3306
head得到头部6行
head -n +6 Dockerfile或head -n 6 Dockerfile
[root@localhost mysqlDockerfile]# head -n +6 Dockerfile #############################################################dckerfile to build mysql for mir container images# Based on Ubuntu# ############################################################FROM 172.16.101.192/common/mysql:5.6# File Author / Maintainer
删掉尾部2行(并没有从文件删除掉)
head -n -6 Dockerfile
#############################################################dckerfile to build mysql for mir container images# Based on Ubuntu# ############################################################FROM 172.16.101.192/common/mysql:5.6# File Author / MaintainerMAINTAINER huzhengbo#ADD mir_scalr.sql to container docker-entrypoint-initdb.dADD analytics.sql /docker-entrypoint-initdb.dADD scalr.sql /docker-entrypoint-initdb.dADD keycloak.sql /docker-entrypoint-initdb.dADD mirmon.sql /docker-entrypoint-initdb.d
删除掉头部6行
tail -n +5 Dockerfile或tail -n 5 Dockerfile
FROM 172.16.101.192/common/mysql:5.6
# File Author / MaintainerMAINTAINER huzhengbo#ADD mir_scalr.sql to container docker-entrypoint-initdb.dADD analytics.sql /docker-entrypoint-initdb.dADD scalr.sql /docker-entrypoint-initdb.dADD keycloak.sql /docker-entrypoint-initdb.dADD mirmon.sql /docker-entrypoint-initdb.dADD mir_scalr.sql /docker-entrypoint-initdb.dADD mir_pack.sql /docker-entrypoint-initdb.dADD oneaa.sql /docker-entrypoint-initdb.dADD one_log.sql /docker-entrypoint-initdb.d#the mysql portEXPOSE 3306得到尾部5行
tail -n -5 Dockerfile
ADD mir_pack.sql /docker-entrypoint-initdb.dADD oneaa.sql /docker-entrypoint-initdb.dADD one_log.sql /docker-entrypoint-initdb.d#the mysql portEXPOSE 3306