Under centos7 environment, docker create a mirror

Create a mirror by Dockerfile

Note: This Dockerfile start really do not know is where's, thought it was downloaded from the official website (of course, the Internet also has a lot of dockerfile template, refer to: https: //hub.docker.com/), in fact it is get yourself a new file name for dockerfile, docker build to create a new image file retrieval dockerfile the content of this dockerfile feels a bit like a local source linux is / dev / sr0 function.

 

This experiment was to base (base) is mounted a mirror vim command, and then made into a new image

First make dockerfile

To create a new image by docker build command, -t parameter is the new image name     .   Location dockerfile file   .  Is the current location, you can use -f to develop a position dockerfile

Creation process: all the files in the directory where the docker will dockerfile docker sent to the server, so use caution will build context, it is best not to excess files into build context, especially not the / or / usr as build context, otherwise the image creation process will be very slow or creation failed.

dockerfile the like ADD COPY command to add file to build context mirror

Creating success

View new image

View dockerfile process execution, docker history shows us the layered mirrored top to bottom.

 

 

 

Docker outlined the process:

Run a mirror base 1. The base (the FROM)

2. Run, the vessel was modified

3. Save the new image layer (and docker commit command)

4. Continue dockerfile inside the command

The re-save one new image

6. Continue command until the command is all finished, each will execute a command to save a new mirror, until the last one.

Guess you like

Origin blog.csdn.net/persistencegoing/article/details/93630177