简体   繁体   中英

Dockerfile - Creating dockerfile

I'm trying to pull tomcat from the Dockerfile I have created and pull centos using the command:

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?

First you need to build your Dockerfile into a docker image:

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 :

FROM my-custom-image

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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