Docker study notes three: operating Docker image

 
1. List the mirror list: docker images 
 
2. Get a new mirror: docker pull ubuntu: 13.10
 
3. Find Mirror: docker search httpd
 
4. Mirror pulling them: docker pull httpd
 
5. Mirror: docker run httpd
 
6. Remove Mirror: docker rmi httpd
 
7. Set mirror Tags: docker tag <containers ID> test / centos: dev
 
8. Create image:
 
    (1) update image has been created from container and submit this image
 
        . A mirror used to create a container: docker run -t -i ubuntu: 15.10 / bin / bash
 
        b. Make apt-get update using the update command within the operating container.
 
        c. Enter the exit command to exit the container
 
        . D container to submit a copy of the command docker commit: docker commit -m = "has update" -a = "tester" <container id> test / ubuntu: v2
             Various parameters:
      -m: description of the information submitted
      -a: Specifies the mirroring of
      test / ubuntu: v2: Specifies the name of the target image to be created
 
        . E view the new image runoob / ubuntu: v2: docker images 
 
    (2) instructions to use Dockerfile create a new image
 
            . A Dockerfile create a file, the file contents are as follows:
 FROM centos:6.7
 MAINTAINER Fisher "[email protected]"
 
 RUN /bin/echo 'root:123456' |chpasswd
 RUN useradd test
 RUN /bin/echo 'test:123456' |chpasswd
 RUN /bin/echo -e "LANG=\"en_US.UTF-8\"" >/etc/default/local
 EXPOSE 22
 EXPOSE 80
 CMD /usr/sbin/sshd -D
     Each command will create a new layer on the mirror, prefix each command must be capitalized. 
      The first FROM, which mirror source specify
      RUN command tells docker execute commands in the mirror, what is installed
            b constructed by a mirror docker build command:. docker build -t test / centos: 6.7
                Parameter Description:
                    -t: Specifies the name of the target image to be created
           .: Dockerfile file directory, you can specify the absolute path Dockerfile
 
   c view mirror created:. docker images (should the new mirrors already exists)
 
   . D used to create a new image container: docker run -t -i test / centos: 6.7 / bin / bash
 
   . E enter into the container: id test (new image has been created that contains the user test us)
 
 
These are the common instruction operation Docker mirrored details, refer to: https://www.w3cschool.cn/docker/docker-tutorial.html .

Guess you like

Origin www.cnblogs.com/daydayup-lin/p/11858308.html