简体   繁体   English

Dockerfile-创建dockerfile

[英]Dockerfile - Creating dockerfile

I'm trying to pull tomcat from the Dockerfile I have created and pull centos using the command: 我正在尝试从已创建的Dockerfile中提取tomcat并使用以下命令来获取centos:

FROM centos
RUN docker run -it tomcat

Then now I'm creating a new Dockerfile, how do I pull the tomcat from the Dockerfile I've created above without pulling from the Docker Hub? 然后,现在我正在创建一个新的Dockerfile,如何从上面创建的Dockerfile中拉出tomcat,而不从Docker Hub中拉出?

First you need to build your Dockerfile into a docker image: 首先,您需要将Dockerfile构建到Docker映像中:

docker build -t my-custom-image .

Now you can base another docker container from the image you created, just like you were doing with centos : 现在,您可以根据创建的映像建立另一个docker容器,就像使用centos

FROM my-custom-image

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM