dockerfile脚本
FROM centos
VOLLUM ["volume01"]
CMD echo "---end---"
CMD /bin/bash
docker build -f dockerfile -t khm/centos .
DockerFile指令
FROM
MAINTAINER
RUN
ADD
WORKDIR
VLUME
EXPOSE
CMD
ENTRYPOINT
ONBUILD
COPY
ENV
构建自己的centos
mkdir dockerfile
vim mydocker
FROM centos
MAINTAINER khm<khmerl@163.com>
ENV MYPATH /usr/local
WORKDIR $MYPATH
RUN yum -y install vim
RUN yum -y install net-tools
EXPOSE 80
CMD echo $MYPATH
CMD /bin/bash
docker build -f mydocker -t mycentos:1.0 .
docker images
docker run -it mycentos:1.0
构建tomcat镜像
vim Dockerfile
FROM centos
MAINTAINER khm<khmerl@163.com>
COPY readme.txt /usr/local/readme.txt
ADD jdk-8u... /usr/local/
ADD tomcat... /usr/local/
RUN yum -y install vim
EVN MYPATH /usr/local
WORKDIR $MYPATH
EVN JAVA_HOME /usr/local/jdk1.8.0_11
EVN CLASSPATH $JAVA_HOME/lib/dt.jar;$JAVA_HOME/lib/tools.jar
EVN CATALINA_HOME /usr/local/apache-tomcat-9.0.22
EVN CATALINA_BASH /usr/local/apache-tomcat-9.0.22
EVN PATH $PATH;$JAVA_HOME/bin;$CATALINA_HOME/lib;$CATALINA_HOME/bin
EXPOSE 8080
CMD /usr/local/apache-tomcat-9.0.22/bin/startup.sh && tail -F /url/local/apache-tomcat-9.0.22/bin/logs/catalina.out
docker build -t diytomcat .
docker images
docker run -d -p 9090:8080 --name diytomcat -v /home/khm/build/tomcat/test:/usr/local/apache-tomcat-9.0.22/webapps/test -v /home/khm/build/tomcat/tomcatlogs/:/usr/local/apache-tomcat-9.0.22/logs
docker exec -it 容器id
curl localhost:9090
发布自己镜像
dockerhub
docker login -u khm
docker tag 容器id khm/khm/名字:版本号
docker push khm/名字:版本号
aliyun
1.登录阿里云
2.找到容器镜像服务
3.创建命名空间
4.创建容器镜像
5.浏览阿里云
|