(Xii) the use of simple instructions Dockerfile reserved words, try to customize centos mirror

                                                             demand

       Centos mirror their own use Dockerfile build its own custom. Since centos mirror can be used in the definition of vim command (Lite centos mirror is not the vim).

First, to see all the information docker in the mirror. Mirror in FIG no custom cnetos, will use a custom Dockerfile.

  

Second, create a file Dockerfile

  1. Create a file called Dockerfile_MyCentos of
    touch Dockerfile_MyCentos 
  2. Write the following to the file
    # From the parent class mirror 
    the FROM CentOS 
    # declare an environment variable 
    ENV MYPATH / Home 
    default directory # custom into the vessel 
    WORKDIR $ MYPATH 
    # install vim command 
    RUN yum  install - the y-vim 
    # vim command output installed successfully 
    RUN echo ----- vim --------- install Success ----------------- 
    # Foreign exposed port 
    eXPOSE 80 
    CMD / bin / bash
  3. Use docker bulid order to build a custom centos
    docker build -f /home/my-docker-file/Dockerfile_MyCentos -t qizhi/centos:1.0 .

  4. View custom images

Third, Run and enter the custom images used vim command to test

  1. Run a custom image
    docker run -it 47548c89aee8
  2. After entering the default path to see if the container changed
  3. Use vim command to test

 

Guess you like

Origin www.cnblogs.com/asxf/p/11238058.html