FROM centos
RUN yum install -y curl
CMD [ "curl", "-s", "http://ip.cn" ]
FROM centos:7.4.1708
RUN yum install -y curl
ENTRYPOINT [ "curl", "-s", "https://ip.cn/" ]
FROM centos:7.4.1708
RUN yum install -y curl
ENTRYPOINT [ "curl", "-s", "https://ip.cn/" ]
ONBUILD RUN echo "father images onbuild----skt one"
FROM centos:7.4.1708
MAINTAINER zdw<zdwbm@163@163.com>
#把宿主机当前上下文的c.txt拷贝到容器/usr/local/路径下
COPY c.txt /usr/local/cincontainer.txt
#把java与tomcat添加到容器中
ADD jdk-8u191-linux-x64.tar.gz /usr/local/
ADD apache-tomcat-9.0.17.tar.gz /usr/local/
#安装vim编辑器
RUN yum -y install vim
#设置工作访问时候的WORKDIR路径,登录落脚点
ENV MYPATH /usr/local
WORKDIR $MYPATH
#配置java与tomcat环境变量
ENV JAVA_HOME /usr/local/jdk-8u191
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV CATALINA_HOME /usr/local/apache-tomcat-9.0.17
ENV CATALINA_BASE /usr/local/apache-tomcat-9.0.17
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin
#容器运行时监听的端口
EXPOSE 8080
#启动时运行tomcat
# ENTRYPOINT ["/usr/local/apache-tomcat-9.0.17/bin/startup.sh"]
# CMD ["/usr/local/apache-tomcat-9.0.17/bin/catalina.sh","run"]
CMD /usr/local/apache-tomcat-9.0.17/bin/startup.sh && tail -F /usr/local/apache-tomcat-9.0.17/bin/logs/catalina.out
docker build -t zdwtomcat3 .
docker run -d -p 7778:8080 --name myt007 -v /zzyyuse/mydockerfile/tomcat9/test:/usr/local/apache-tomcat-9.0.17/webapps/test -v /zzyyuse/mydockerfile/tomcat9/tomcat9logs/:/usr/local/apache-tomcat-9.0.17/logs --privileged=true zdwtomcat7777
http://localhost:7778/
docker exec 079587c5a41d ls -l
===============
docker安装mysql
docker run -p 12345:3306 --name mysql -v /zzyyuse/mysql/conf:/etc/mysql/conf.d -v /zzyyuse/mysql/logs:/logs -v /zzyyuse/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6
docker run -p 12345:3306 --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6
docker exec -it MySQL运行成功后的容器ID /bin/bash
docker exec -it 049e41b963025df97737e0fc9975bc9ae983919f936f8901f68abe2eea5c654f /bin/bash
mysql -u root -p
docker exec -it 0a081b32809e931e2eebb48792fe9bd18dd5ac1c8bbc419b41e30d09024a78ea /bin/bash
网友评论